Fields Summary |
---|
private static final long | serialVersionUID |
private final byte | valueThe value which the receiver represents. |
public static final byte | MAX_VALUEThe maximum {@code Byte} value, 27-1. |
public static final byte | MIN_VALUEThe minimum {@code Byte} value, -27. |
public static final int | SIZEThe number of bits needed to represent a {@code Byte} value in two's
complement form. |
public static final Class | TYPEThe {@link Class} object that represents the primitive type {@code byte}. |
private static final Byte[] | CACHEA cache of instances used by {@link #valueOf(byte)} and auto-boxing. |
Methods Summary |
---|
public byte | byteValue()Gets the primitive value of this byte.
return value;
|
public int | compareTo(java.lang.Byte object)Compares this object to the specified byte object to determine their
relative order.
return value > object.value ? 1 : (value < object.value ? -1 : 0);
|
public static java.lang.Byte | decode(java.lang.String string)Parses the specified string and returns a {@code Byte} instance if the
string can be decoded into a single byte value. The string may be an
optional minus sign "-" followed by a hexadecimal ("0x..." or "#..."),
octal ("0..."), or decimal ("...") representation of a byte.
int intValue = Integer.decode(string).intValue();
byte result = (byte) intValue;
if (result == intValue) {
return valueOf(result);
}
throw new NumberFormatException();
|
public double | doubleValue()
return value;
|
public boolean | equals(java.lang.Object object)Compares this object with the specified object and indicates if they are
equal. In order to be equal, {@code object} must be an instance of
{@code Byte} and have the same byte value as this object.
return (object == this) || (object instanceof Byte)
&& (value == ((Byte) object).value);
|
public float | floatValue()
return value;
|
public int | hashCode()
return value;
|
public int | intValue()
return value;
|
public long | longValue()
return value;
|
public static byte | parseByte(java.lang.String string)Parses the specified string as a signed decimal byte value. The ASCII
character \u002d ('-') is recognized as the minus sign.
int intValue = Integer.parseInt(string);
byte result = (byte) intValue;
if (result == intValue) {
return result;
}
throw new NumberFormatException();
|
public static byte | parseByte(java.lang.String string, int radix)Parses the specified string as a signed byte value using the specified
radix. The ASCII character \u002d ('-') is recognized as the minus sign.
int intValue = Integer.parseInt(string, radix);
byte result = (byte) intValue;
if (result == intValue) {
return result;
}
throw new NumberFormatException();
|
public short | shortValue()
return value;
|
public java.lang.String | toString()
return Integer.toString(value);
|
public static java.lang.String | toString(byte value)Returns a string containing a concise, human-readable description of the
specified byte value.
return Integer.toString(value);
|
public static java.lang.Byte | valueOf(java.lang.String string)Parses the specified string as a signed decimal byte value.
return valueOf(parseByte(string));
|
public static java.lang.Byte | valueOf(java.lang.String string, int radix)Parses the specified string as a signed byte value using the specified
radix.
return valueOf(parseByte(string, radix));
|
public static java.lang.Byte | valueOf(byte b)Returns a {@code Byte} instance for the specified byte value.
If it is not necessary to get a new {@code Byte} instance, it is
recommended to use this method instead of the constructor, since it
maintains a cache of instances which may result in better performance.
synchronized (CACHE) {
int idx = b - MIN_VALUE;
Byte result = CACHE[idx];
return (result == null ? CACHE[idx] = new Byte(b) : result);
}
|