Integer class


The Integer class wraps a value of the primitive type int. Integer class provides several methods for converting an int to a String and a String to an int.

static intMAX_VALUEMaximum value an int can have.
static intMIN_VALUEMinimum value an int can have.
static intSIZEThe number of bits used to represent an int value.
static ClassTYPEThe Class instance representing the primitive type int.

Constructor Summary

Integer(int value)Creates an Integer object for the int value.
Integer(String s)Creates an Integer object for the int value indicated by the String parameter.

Return an integer value as byte, double, float, int, long and short

bytebyteValue()Returns this Integer as a byte.
doubledoubleValue()Returns this Integer as a double.
floatfloatValue()Returns this Integer as a float.
intintValue()Returns this Integer as an int.
longlongValue()Returns this Integer as a long.
shortshortValue()Returns this Integer as a short.

Compare two integer values

intcompareTo(Integer anotherInteger)Compares two Integer objects numerically.
booleanequals(Object obj)Compares this object to the specified object.

Decode a string and return an integer value

static Integerdecode(String nm)Decodes a String into an Integer.

Convert string to integer

static intparseInt(String s)Parses the string argument as a signed decimal integer.
static intparseInt(String s, int radix)Parses the string argument in the radix.
static IntegervalueOf(int i)Returns a Integer instance representing the int value.
static IntegervalueOf(String s)Returns an Integer holding the value of the String.
static IntegervalueOf(String s, int radix)Returns an Integer from String based on the radix.

Convert integer to string

StringtoString()Returns a String object representing this Integer's value.
static StringtoString(int i)Returns a String object representing the specified integer.
static StringtoString(int i, int radix)Returns a string representation of i in radix.

Reverse and rotate the integer in binary format

static intreverse(int i)Reversing the bits.
static intreverseBytes(int i)Reversing the bytes.
static introtateLeft(int i, int distance)Rotating the bits by distance.
static introtateRight(int i, int distance)Rotating the bits by distance.

Bit oriented operation

static intbitCount(int i)Count bits in the binary representation of the specified int value.
static inthighestOneBit(int i)Returns an int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit.
static intlowestOneBit(int i)Returns an int value with at most a single one-bit, in the position of the lowest-order ("rightmost") one-bit.

Return system property as integer

static IntegergetInteger(String nm)Get the system property.
static IntegergetInteger(String nm, int val)Get the integer value of the system property with a default value.
static IntegergetInteger(String nm, Integer val)Returns the integer value of the system property with a default value.

Get the leading and trailing zeros

static intnumberOfLeadingZeros(int i)Returns the number of zero bits preceding the highest-order ("leftmost") one-bit.
static intnumberOfTrailingZeros(int i)Returns the number of zero bits following the lowest-order ("rightmost") one-bit.

Get the sign

static intsignum(int i)Returns the sign.

Convert integer to binary, hexdecimal and octal format

static StringtoBinaryString(int i)Return the binary string for i.
static StringtoHexString(int i)Returns a hes string for i.
static StringtoOctalString(int i)Returns a octal string for i.  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.