The methods defined byFloatare shown in Table 16-1. The methods defined byDouble
are shown in Table 16-2. BothFloatandDoubledefine the following constants:
MAX_EXPONENT Maximum exponent (Added by Java SE 6.)
MAX_VALUE Maximum positive value
MIN_EXPONENT Minimum exponent (Added by Java SE 6.)
MIN_NORMAL Minimum positive normal value (Added by Java SE 6.)
MIN_VALUE Minimum positive value
NaN Not a number
POSITIVE_INFINITY Positive infinity
NEGATIVE_INFINITY Negative infinity
SIZE The bit width of the wrapped value
TYPE TheClassobject forfloatordouble
Chapter 16: Exploring java.lang 387
Method Description
byte byteValue( ) Returns the value of the invoking object as abyte.
static int compare(floatnum1,
floatnum2)
Compares the values ofnum1andnum2.Returns 0 if
the values are equal. Returns a negative value ifnum1
is less thannum2.Returns a positive value ifnum1is
greater thannum2.
int compareTo(Floatf) Compares the numerical value of the invoking object with that
off.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.
double doubleValue( ) Returns the value of the invoking object as adouble.
boolean equals(ObjectFloatObj) Returnstrueif the invokingFloatobject is equivalent to
FloatObj.Other wise, it returnsfalse.
static int floatToIntBits(floatnum) Returns the IEEE-compatible, single-precision bit pattern
that corresponds tonum.
static int floatToRawIntBits(floatnum) Returns the IEEE-compatible single-precision bit pattern
that corresponds tonum. A NaN value is preser ved.
float floatValue( ) Returns the value of the invoking object as afloat.
int hashCode( ) Returns the hash code for the invoking object.
static float intBitsToFloat(intnum) Returnsfloatequivalent of the IEEE-compatible,
single-precision bit pattern specified bynum.
int intValue( ) Returns the value of the invoking object as anint.
boolean isInfinite( ) Returnstrueif the invoking object contains an infinite value.
Other wise, it returnsfalse.
static boolean isInfinite(floatnum) Returnstrueifnumspecifies an infinite value. Other wise,
it returnsfalse.
TABLE 16-1 The Methods Defined byFloat