388 Part II: The Java Library
Method Description
boolean isNaN( ) Returnstrueif the invoking object contains a value that is
not a number. Other wise, it returnsfalse.
static boolean isNaN(floatnum) Returnstrueifnumspecifies a value that is not a number.
Other wise, it returnsfalse.
long longValue( ) Returns the value of the invoking object as along.
static float parseFloat(Stringstr)
throws NumberFormatException
Returns thefloatequivalent of the number contained in the
string specified bystrusing radix 10.
short shortValue( ) Returns the value of the invoking object as ashort.
static String toHexString(floatnum) Returns a string containing the value ofnumin
hexadecimal format.
String toString( ) Returns the string equivalent of the invoking object.
static String toString(floatnum) Returns the string equivalent of the value specified bynum.
static Float valueOf(floatnum) Returns aFloatobject containing the value passed innum.
static Float valueOf(Stringstr)
throws NumberFormatException
Returns theFloatobject that contains the value specified
by the string instr.
TABLE 16-1 The Methods Defined byFloat(continued)
Method Description
byte byteValue( ) Returns the value of the invoking object as abyte.
static int compare(doublenum1,
doublenum2)
Compares the values ofnum1andnum2.Returns 0
if the values are equal. Returns a negative value if
num1is less thannum2.Returns a positive value if
num1is greater thannum2.
int compareTo(Doubled) Compares the numerical value of the invoking object
with that ofd.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 long doubleToLongBits(doublenum) Returns the IEEE-compatible, double-precision bit
pattern that corresponds tonum.
static long doubleToRawLongBits(doublenum) Retuns the IEEE-compatible double-precision bit
pattern that corresponds tonum. A NaN value is
preser ved.
double doubleValue( ) Returns the value of the invoking object as adouble.
boolean equals(ObjectDoubleObj) Returnstrueif the invokingDoubleobject is equivalent
toDoubleObj.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.
TABLE 16-2 The Methods Defined byDouble