2015-03-13 18:52:59 +00:00
|
|
|
/* Copyright (c) 2008-2015, Avian Contributors
|
2008-02-19 18:06:52 +00:00
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software
|
|
|
|
for any purpose with or without fee is hereby granted, provided
|
|
|
|
that the above copyright notice and this permission notice appear
|
|
|
|
in all copies.
|
|
|
|
|
|
|
|
There is NO WARRANTY for this software. See license.txt for
|
|
|
|
details. */
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
package java.lang;
|
|
|
|
|
2007-10-29 00:51:08 +00:00
|
|
|
public final class Byte extends Number implements Comparable<Byte> {
|
2013-02-22 18:55:01 +00:00
|
|
|
public static final Class TYPE = avian.Classes.forCanonicalName("B");
|
2007-07-27 02:39:53 +00:00
|
|
|
|
2014-11-19 11:27:11 +00:00
|
|
|
public static final byte MIN_VALUE = -128;
|
|
|
|
public static final byte MAX_VALUE = 127;
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
private final byte value;
|
|
|
|
|
|
|
|
public Byte(byte value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
2007-08-13 00:50:25 +00:00
|
|
|
public static Byte valueOf(byte value) {
|
|
|
|
return new Byte(value);
|
|
|
|
}
|
|
|
|
|
2007-07-29 23:32:23 +00:00
|
|
|
public boolean equals(Object o) {
|
|
|
|
return o instanceof Byte && ((Byte) o).value == value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return toString(value);
|
|
|
|
}
|
|
|
|
|
2007-10-29 00:51:08 +00:00
|
|
|
public int compareTo(Byte o) {
|
|
|
|
return value - o.value;
|
|
|
|
}
|
|
|
|
|
2007-07-29 23:32:23 +00:00
|
|
|
public static String toString(byte v, int radix) {
|
|
|
|
return Long.toString(v, radix);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String toString(byte v) {
|
|
|
|
return toString(v, 10);
|
|
|
|
}
|
|
|
|
|
2007-10-29 20:57:33 +00:00
|
|
|
public static byte parseByte(String s) {
|
|
|
|
return (byte) Integer.parseInt(s);
|
|
|
|
}
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
public byte byteValue() {
|
|
|
|
return value;
|
|
|
|
}
|
2007-07-21 17:50:26 +00:00
|
|
|
|
|
|
|
public short shortValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int intValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long longValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float floatValue() {
|
|
|
|
return (float) value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public double doubleValue() {
|
|
|
|
return (double) value;
|
|
|
|
}
|
2007-07-20 03:18:25 +00:00
|
|
|
}
|