java.lang
Class Byte

java.lang.Object
  |
  +--java.lang.Number
        |
        +--java.lang.Byte
All Implemented Interfaces:
Comparable, Serializable

public final class Byte
extends Number
implements Comparable

The Byte class is the standard wrapper for byte values.

Since:
JDK1.1
See Also:
Number, Serialized Form

Field Summary
static byte MAX_VALUE
copy->  MAX_VALUE
The maximum value a Byte can have.
static byte MIN_VALUE
copy->  MIN_VALUE
The minimum value a Byte can have.
static Class TYPE
copy->  TYPE
The Class object representing the primitive type byte.
 
Constructor Summary
Byte
copy->  new Byte( )
copy->  <Byte var> = new Byte(<byte value>);
Constructs a Byte object initialized to the specified byte value.
Parameters:
value - the initial value of the Byte
Byte
copy->  new Byte( )
copy->  <Byte var> = new Byte(<String s>);
Constructs a Byte object initialized to the value specified by the String parameter. The radix is assumed to be 10.
Parameters:
s - the String to be converted to a Byte
Throws:
NumberFormatException - If the String does not contain a parsable byte.
 
Method Summary
 byte byteValue()
copy->  .byteValue()
copy->  <byte var>=<Byte>.byteValue();
Returns the value of this Byte as a byte.
Overrides:
byteValue in class Number
Following copied from class: java.lang.Number
Returns:
the numeric value represented by this object after conversion to type byte.
 int compareTo(Byte anotherByte)
copy->  .compareTo( )
copy->  <int var>=<Byte>.compareTo(<Byte anotherByte>);
Compares two Bytes numerically.
Parameters:
anotherByte - the Byte to be compared.
Returns:
the value 0 if the argument Byte is equal to this Byte; a value less than 0 if this Byte is numerically less than the Byte argument; and a value greater than 0 if this Byte is numerically greater than the Byte argument (signed comparison).
Since:
1.2
 int compareTo(Object o)
copy->  .compareTo( )
copy->  <int var>=<Byte>.compareTo(<Object o>);
Compares this Byte to another Object. If the Object is a Byte, this function behaves like compareTo(Byte). Otherwise, it throws a ClassCastException (as Bytes are comparable only to other Bytes).
Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
the value 0 if the argument is a Byte numerically equal to this Byte; a value less than 0 if the argument is a Byte numerically greater than this Byte; and a value greater than 0 if the argument is a Byte numerically less than this Byte.
Throws:
ClassCastException - if the argument is not a Byte.
Since:
1.2
See Also:
Comparable
static Byte decode(String nm)
copy->  Byte.decode( )
copy->  <Byte var>=Byte.decode(<String nm>);
Decodes a String into a Byte. Accepts decimal, hexadecimal, and octal numbers, in the following formats:
     [-]       decimal constant
     [-] 0x    hex constant
     [-] #     hex constant
     [-] 0     octal constant
 
The constant following an (optional) negative sign and/or "radix specifier" is parsed as by the Byte.parseByte method with the specified radix (10, 8 or 16). This constant must be positive or a NumberFormatException will result. The result is made negative if first character of the specified String is the negative sign. No whitespace characters are permitted in the String.
Parameters:
nm - the String to decode.
Returns:
the Byte represented by the specified string.
Throws:
NumberFormatException - if the String does not contain a parsable byte.
See Also:
parseByte(String, int)
 double doubleValue()
copy->  .doubleValue()
copy->  <double var>=<Byte>.doubleValue();
Returns the value of this Byte as a double.
Overrides:
doubleValue in class Number
Following copied from class: java.lang.Number
Returns:
the numeric value represented by this object after conversion to type double.
 boolean equals(Object obj)
copy->  .equals( )
copy->  <boolean var>=<Byte>.equals(<Object obj>);
Compares this object to the specified object.
Overrides:
equals in class Object
Parameters:
obj - the object to compare with
Returns:
true if the objects are the same; false otherwise.
 float floatValue()
copy->  .floatValue()
copy->  <float var>=<Byte>.floatValue();
Returns the value of this Byte as a float.
Overrides:
floatValue in class Number
Following copied from class: java.lang.Number
Returns:
the numeric value represented by this object after conversion to type float.
 int hashCode()
copy->  .hashCode()
copy->  <int var>=<Byte>.hashCode();
Returns a hashcode for this Byte.
Overrides:
hashCode in class Object
Following copied from class: java.lang.Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable
 int intValue()
copy->  .intValue()
copy->  <int var>=<Byte>.intValue();
Returns the value of this Byte as an int.
Overrides:
intValue in class Number
Following copied from class: java.lang.Number
Returns:
the numeric value represented by this object after conversion to type int.
 long longValue()
copy->  .longValue()
copy->  <long var>=<Byte>.longValue();
Returns the value of this Byte as a long.
Overrides:
longValue in class Number
Following copied from class: java.lang.Number
Returns:
the numeric value represented by this object after conversion to type long.
static byte parseByte(String s)
copy->  Byte.parseByte( )
copy->  <byte var>=Byte.parseByte(<String s>);
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.
Parameters:
s - the String containing the byte
Returns:
the parsed value of the byte
Throws:
NumberFormatException - If the string does not contain a parsable byte.
static byte parseByte(String s, int radix)
copy->  Byte.parseByte(, )
copy->  <byte var>=Byte.parseByte(<String s>, <int radix>);
Assuming the specified String represents a byte, returns that byte's value. Throws an exception if the String cannot be parsed as a byte.
Parameters:
s - the String containing the byte
radix - the radix to be used
Returns:
the parsed value of the byte
Throws:
NumberFormatException - If the String does not contain a parsable byte.
 short shortValue()
copy->  .shortValue()
copy->  <short var>=<Byte>.shortValue();
Returns the value of this Byte as a short.
Overrides:
shortValue in class Number
Following copied from class: java.lang.Number
Returns:
the numeric value represented by this object after conversion to type short.
 String toString()
copy->  .toString()
copy->  <String var>=<Byte>.toString();
Returns a String object representing this Byte's value.
Overrides:
toString in class Object
Following copied from class: java.lang.Object
Returns:
a string representation of the object.
static String toString(byte b)
copy->  Byte.toString( )
copy->  <String var>=Byte.toString(<byte b>);
Returns a new String object representing the specified Byte. The radix is assumed to be 10.
Parameters:
b - the byte to be converted
Returns:
the string representation of the specified byte
static Byte valueOf(String s)
copy->  Byte.valueOf( )
copy->  <Byte var>=Byte.valueOf(<String s>);
Assuming the specified String represents a byte, returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10.
Parameters:
s - the String containing the integer
Returns:
the Byte instance representing the parsed byte value
Throws:
NumberFormatException - If the String does not contain a parsable byte.
static Byte valueOf(String s, int radix)
copy->  Byte.valueOf(, )
copy->  <Byte var>=Byte.valueOf(<String s>, <int radix>);
Assuming the specified String represents a byte, returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte.
Parameters:
s - the String containing the integer
radix - the radix to be used
Returns:
the Byte instance representing the parsed byte value
Throws:
NumberFormatException - If the String does not contain a parsable byte.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait