Java The Complete Reference, Seventh Edition

(Greg DeLong) #1

392 Part II: The Java Library


Method Description
byte byteValue( ) Returns the value of the invoking object as abyte.
int compareTo(Shorts) Compares the numerical value of the invoking object
with that ofs.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 Short decode(Stringstr)
throws NumberFormatException

Returns aShortobject that contains the value
specified by the string instr.
double doubleValue( ) Returns the value of the invoking object as adouble.
boolean equals(ObjectShortObj) Returnstrueif the invokingShortobject is equivalent
toShortObj.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 short parseShort(Stringstr)
throws NumberFormatException

Returns theshortequivalent of the number contained
in the string specified bystrusing radix 10.
static short parseShort(Stringstr, intradix)
throws NumberFormatException

Returns theshortequivalent of the number contained
in the string specified bystrusing the specifiedradix.
static short reverseBytes(shortnum) Exchanges the high- and low-order bytes ofnum
and returns the result.
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(shortnum) Returns a string that contains the decimal
equivalent ofnum.
static Short valueOf(shortnum) Returns aShortobject containing the value passed
innum.
static Short valueOf(Stringstr)
throws NumberFormatException

Returns aShortobject that contains the value
specified by the string instrusing radix 10.
static Short valueOf(Stringstr, intradix)
throws NumberFormatException

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

TABLE 16-4 The Methods Defined byShort
Free download pdf