Class Byte
java.lang.Object
java.lang.Number
java.lang.Byte
- All Implemented Interfaces:
Comparable<Byte>
The Byte class is the standard wrapper for byte values.
Since: JDK1.1, CLDC 1.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteReturns the value of this Byte as a byte.static intcompare(byte b1, byte b2) intCompares this object to the specified object to determine their relative order.static intcompareUnsigned(byte x, byte y) Compares the two as unsigned values.static ByteDecodes a decimal, hexadecimal or octal byte, asInteger.decode.doublebooleanCompares this object to the specified object.floatinthashCode()Returns a hashcode for this Byte.static inthashCode(byte value) The value itself.intintValue()longstatic byteAssuming the specified String represents a byte, returns that byte's value.static byteAssuming the specified String represents a byte, returns that byte's value.toString()Returns a String object representing this Byte's value.static StringtoString(byte b) The decimal string ofb.static inttoUnsignedInt(byte x) The value as an unsigned int.static longtoUnsignedLong(byte x) The value as an unsigned long.static BytevalueOf(byte i) Returns the object instance of istatic ByteA Byte ofparseByte(s).static ByteA Byte ofparseByte(s, radix).Methods inherited from class Number
shortValue
-
Field Details
-
TYPE
-
SIZE
public static final int SIZE- See Also:
-
MAX_VALUE
public static final byte MAX_VALUEThe maximum value a Byte can have. See Also:Constant Field Values- See Also:
-
MIN_VALUE
public static final byte MIN_VALUEThe minimum value a Byte can have. See Also:Constant Field Values- See Also:
-
BYTES
public static final int BYTESThe size of a byte in bytes.- See Also:
-
-
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
-
-
Method Details
-
byteValue
-
equals
-
hashCode
-
parseByte
Assuming 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:
NumberFormatException
-
parseByte
Assuming the specified String represents a byte, returns that byte's value. Throws an exception if the String cannot be parsed as a byte.- Throws:
NumberFormatException
-
toString
-
valueOf
Returns the object instance of i
Parameters
i: the primitive
Returns
object instance
-
intValue
-
longValue
-
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein classNumber
-
compare
public static int compare(byte b1, byte b2) -
compareTo
Description copied from interface:ComparableCompares this object to the specified object to determine their relative order.
Parameters
another: the object to compare to this instance.
Returns
- Specified by:
compareToin interfaceComparable<Byte>- Returns:
a negative integer if this instance is less than
another; a positive integer if this instance is greater thananother; 0 if this instance has the same order asanother.Throws
ClassCastException: @throws ClassCastException ifanothercannot be converted into something comparable tothisinstance.
-
toString
The decimal string ofb. -
valueOf
A Byte ofparseByte(s).- Throws:
NumberFormatException
-
valueOf
A Byte ofparseByte(s, radix).- Throws:
NumberFormatException
-
decode
Decodes a decimal, hexadecimal or octal byte, asInteger.decode.- Throws:
NumberFormatException
-
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.
-