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
ConstructorsConstructorDescriptionByte(byte value) Constructs a Byte object initialized to the specified byte value. -
Method Summary
Modifier and TypeMethodDescriptionbyteReturns the value of this Byte as a byte.intcompare(byte b1, byte b2) intCompares this object to the specified object to determine their relative order.doublebooleanequals(java.lang.Object obj) Compares this object to the specified object.floatinthashCode()Returns a hashcode for this Byte.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 BytevalueOf(byte i) Returns the object instance of iMethods inherited from class Number
shortValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
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:
-
-
Constructor Details
-
Byte
public Byte(byte value) Constructs a Byte object initialized to the specified byte value. value - the initial value of the Byte
-
-
Method Details
-
byteValue
-
equals
public boolean equals(java.lang.Object obj) Compares this object to the specified object.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()Returns a hashcode for this Byte.- Overrides:
hashCodein classjava.lang.Object
-
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
Returns a String object representing this Byte's value.- Overrides:
toStringin classjava.lang.Object
-
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 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.
-