Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public final class Byte
ImplementsComparable<Byte>
The Byte class is the standard wrapper for byte values.
Since: JDK1.1, CLDC 1.0
Fields
public static final Class<Byte> TYPE | |
public static final int SIZE = 8 | |
public static final byte MAX_VALUE = 127 | The maximum value a Byte can have. |
public static final byte MIN_VALUE = -128 | The minimum value a Byte can have. |
public static final int BYTES = 1 | The size of a byte in bytes. |
Constructors
public Byte(byte value) | Constructs a Byte object initialized to the specified byte value. |
public Byte(String s)
throws NumberFormatException | Deprecated A Byte of parseByte(s). |
Methods
Inherited methods
From Number
Field details
TYPE
public static final Class<Byte> TYPESIZE
public static final int SIZE = 8MAX_VALUE
public static final byte MAX_VALUE = 127The maximum value a Byte can have.
See Also:Constant Field Values
MIN_VALUE
public static final byte MIN_VALUE = -128The minimum value a Byte can have.
See Also:Constant Field Values
BYTES
public static final int BYTES = 1The size of a byte in bytes.
Constructor details
Byte
public Byte(byte value)Constructs a Byte object initialized to the specified byte value.
value - the initial value of the Byte
Byte
public Byte(String s)
throws NumberFormatExceptionDeprecated.
A Byte of
parseByte(s).Throws
Method details
byteValue
public byte byteValue()Returns the value of this Byte as a byte.
equals
public boolean equals(Object obj)Compares this object to the specified object.
hashCode
public int hashCode()Returns a hashcode for this Byte.
parseByte
public static byte parseByte(String s)
throws NumberFormatExceptionAssuming the specified String represents a byte, returns that byte’s value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10.
Throws
parseByte
public static byte parseByte(String s, int radix)
throws NumberFormatExceptionAssuming the specified String represents a byte, returns that byte’s value. Throws an exception if the String cannot be parsed as a byte.
Throws
toString
public String toString()Returns a String object representing this Byte’s value.
valueOf
public static Byte valueOf(byte i)Returns the object instance of i
Parameters
ibyte- the primitive
Returns
object instance
intValue
public int intValue()longValue
public long longValue()floatValue
public float floatValue()doubleValue
public double doubleValue()compare
public static int compare(byte b1, byte b2)compareTo
public int compareTo(Byte b)Compares this object to the specified object to determine their relative
order.
Parameters
bByte- the object to compare to this instance.
Returns
a negative integer if this instance is less than
another;
a positive integer if this instance is greater than
another; 0 if this instance has the same order as
another.Throws
ClassCastException- if
anothercannot be converted into something comparable tothisinstance.
toString
public static String toString(byte b)The decimal string of
b.valueOf
public static Byte valueOf(String s)
throws NumberFormatExceptionA Byte of
parseByte(s).Throws
valueOf
public static Byte valueOf(String s, int radix)
throws NumberFormatExceptionA Byte of
parseByte(s, radix).Throws
decode
public static Byte decode(String nm)
throws NumberFormatExceptionDecodes a decimal, hexadecimal or octal byte, as
Integer.decode.Throws
hashCode
public static int hashCode(byte value)The value itself.
compareUnsigned
public static int compareUnsigned(byte x, byte y)Compares the two as unsigned values.
toUnsignedInt
public static int toUnsignedInt(byte x)The value as an unsigned int.
toUnsignedLong
public static long toUnsignedLong(byte x)The value as an unsigned long.