Java The Complete Reference, Seventh Edition

(Greg DeLong) #1

394 Part II: The Java Library


Method Description
static int numberOfTrailingZeros(intnum) Returns the number of low-order zero bits that
precede the first low-order set bit innum.Ifnumis
zero, 32 is returned.
static int parseInt(Stringstr)
throws NumberFormatException

Returns the integer equivalent of the number contained
in the string specified bystrusing radix 10.
static int parseInt(Stringstr, intradix)
throws NumberFormatException

Returns the integer equivalent of the number
contained in the string specified bystrusing the
specifiedradix.
static int reverse(intnum) Reverses the order of the bits innumand returns
the result.
static int reverseBytes(intnum) Reverses the order of the bytes innumand returns
the result.
static int rotateLeft(intnum, intn) Returns the result of rotatingnumleftnpositions.
static int rotateRight(intnum, intn) Returns the result of rotatingnumrightnpositions.
static int signum(intnum) Returns –1 ifnumis negative, 0 if it is zero, and 1
if it is positive.
short shortValue( ) Returns the value of the invoking object as ashort.
static String toBinar yString(intnum) Returns a string that contains the binar y equivalent
ofnum.
static String toHexString(intnum) Returns a string that contains the hexadecimal
equivalent ofnum.
static String toOctalString(intnum) Returns a string that contains the octal equivalent
ofnum.
String toString( ) Returns a string that contains the decimal equivalent
of the invoking object.
static String toString(intnum) Returns a string that contains the decimal equivalent
ofnum.
static String toString(intnum, intradix) Returns a string that contains the decimal equivalent
ofnumusing the specifiedradix.
static Integer valueOf(intnum) Returns anIntegerobject containing the value passed
innum.
static Integer valueOf(Stringstr)
throws NumberFormatException

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

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

TABLE 16-5 The Methods Defined byInteger(continued)
Free download pdf