Java The Complete Reference, Seventh Edition

(Greg DeLong) #1

Chapter 16: Exploring java.lang 395


Method Description
static int bitCount(longnum) Returns the number of set bits innum.
byte byteValue( ) Returns the value of the invoking object as abyte.
int compareTo(Longl) Compares the numerical value of the invoking object
with that ofl.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 decode(Stringstr)
throws NumberFormatException

Returns aLongobject that contains the value
specified by the string instr.
double doubleValue( ) Returns the value of the invoking object as adouble.
boolean equals(ObjectLongObj) Returnstrueif the invokingLongobject is equivalent
toLongObj.Other wise, it returnsfalse.
float floatValue( ) Returns the value of the invoking object as afloat.
static Long getLong(StringpropertyName) Returns the value associated with the environmental
property specified bypropertyName.Anullis returned
on failure.
static Long getLong(StringpropertyName,
longdefault)

Returns the value associated with the environmental
property specified bypropertyName.The value of
defaultis returned on failure.
static Long getLong(StringpropertyName,
Longdefault)

Returns the value associated with the environmental
property specified bypropertyName.The value of
defaultis returned on failure.
int hashCode( ) Returns the hash code for the invoking object.
static long highestOneBit(longnum) Determines the position of the highest-order set bit
innum.It returns a value in which only this bit is
set. If no bit is set to one, then zero is returned.
int intValue( ) Returns the value of the invoking object as anint.
long longValue( ) Returns the value of the invoking object as along.
static long lowestOneBit(longnum) Determines the position of the lowest-order set bit
innum.It returns a value in which only this bit is
set. If no bit is set to one, then zero is returned.
static int numberOfLeadingZeros(longnum) Returns the number of high-order zero bits that
precede the first high-order set bit innum.Ifnum
is zero, 64 is returned.
static int numberOfTrailingZeros(longnum) Returns the number of low-order zero bits that
precede the first low-order set bit innum.Ifnum
is zero, 64 is returned.

TABLE 16-6 The Methods Defined byLong

Free download pdf