Java The Complete Reference, Seventh Edition

(Greg DeLong) #1

Chapter 16: Exploring java.lang 391


The following constants are defined:

MIN_VALUE Minimum value
MAX_VALUE Maximum value
SIZE The bit width of the wrapped value
TYPE TheClassobject forbyte,short,int, orlong

Method Description
byte byteValue( ) Returns the value of the invoking object as abyte.
int compareTo(Byteb) Compares the numerical value of the invoking object
with that ofb.Returns 0 if the values are equal.
Returns a negative value if the invoking object has a
lower value. Returns a positive value if the invoking
object has a greater value.
static Byte decode(Stringstr)
throws NumberFormatException

Returns aByteobject that contains the value
specified by the string instr.
double doubleValue( ) Returns the value of the invoking object as adouble.
boolean equals(ObjectByteObj) Returnstrueif the invokingByteobject is
equivalent toByteObj.Other wise, it returnsfalse.
float floatValue( ) Returns the value of the invoking object as afloat.
int hashCode( ) Returns the hash code for the invoking object.
int intValue( ) Returns the value of the invoking object as anint.
long longValue( ) Returns the value of the invoking object as along.
static byte parseByte(Stringstr)
throws NumberFormatException

Returns thebyteequivalent of the number contained
in the string specified bystrusing radix 10.
static byte parseByte(Stringstr, intradix)
throws NumberFormatException

Returns thebyteequivalent of the number contained
in the string specified bystrusing the specified radix.
short shortValue( ) Returns the value of the invoking object as ashort.
String toString( ) Returns a string that contains the decimal equivalent
of the invoking object.
static String toString(bytenum) Returns a string that contains the decimal equivalent
ofnum.
static Byte valueOf(bytenum) Returns aByteobject containing the value passed
innum.
static Byte valueOf(Stringstr)
throws NumberFormatException

Returns aByteobject that contains the value
specified by the string instr.
static Byte valueOf(Stringstr, intradix)
throws NumberFormatException

Returns aByteobject that contains the value
specified by the string instrusing the specifiedradix.

TABLE 16-3 The Methods Defined byByte

Free download pdf