Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » lang » [javadoc | source]
java.lang
public final class: Integer [javadoc | source]
java.lang.Object
   java.lang.Number
      java.lang.Integer

All Implemented Interfaces:
    Comparable, Serializable

The wrapper for the primitive type {@code int}.

As with the specification, this implementation relies on code laid out in Henry S. Warren, Jr.'s Hacker's Delight, (Addison Wesley, 2002) as well as The Aggregate's Magic Algorithms.

Nested Class Summary:
static class  Integer.valueOfCache   
Field Summary
public static final  int MAX_VALUE    Constant for the maximum {@code int} value, 231-1. 
public static final  int MIN_VALUE    Constant for the minimum {@code int} value, -231
public static final  int SIZE    Constant for the number of bits needed to represent an {@code int} in two's complement form.
    since: 1.5 -
 
public static final  Class<Integer> TYPE    The Class object that represents the primitive type {@code int}. 
Constructor:
 public Integer(int value) 
 public Integer(String string) throws NumberFormatException 
    Constructs a new {@code Integer} from the specified string.
    Parameters:
    string - the string representation of an integer value.
    Throws:
    NumberFormatException - if {@code string} can not be decoded into an integer value.
    Also see:
    parseInt(String)
Method from java.lang.Integer Summary:
bitCount,   byteValue,   compareTo,   decode,   doubleValue,   equals,   floatValue,   getInteger,   getInteger,   getInteger,   hashCode,   highestOneBit,   intValue,   longValue,   lowestOneBit,   numberOfLeadingZeros,   numberOfTrailingZeros,   parseInt,   parseInt,   reverse,   reverseBytes,   rotateLeft,   rotateRight,   shortValue,   signum,   toBinaryString,   toHexString,   toOctalString,   toString,   toString,   toString,   valueOf,   valueOf,   valueOf
Methods from java.lang.Number:
byteValue,   doubleValue,   floatValue,   intValue,   longValue,   shortValue
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.lang.Integer Detail:
 public static int bitCount(int i) 
    Counts the number of 1 bits in the specified integer; this is also referred to as population count.
 public byte byteValue() 
 public int compareTo(Integer object) 
    Compares this object to the specified integer object to determine their relative order.
 public static Integer decode(String string) throws NumberFormatException 
    Parses the specified string and returns a {@code Integer} instance if the string can be decoded into an integer value. The string may be an optional minus sign "-" followed by a hexadecimal ("0x..." or "#..."), octal ("0..."), or decimal ("...") representation of an integer.
 public double doubleValue() 
 public boolean equals(Object o) 
    Compares this instance with the specified object and indicates if they are equal. In order to be equal, {@code o} must be an instance of {@code Integer} and have the same integer value as this object.
 public float floatValue() 
 public static Integer getInteger(String string) 
    Returns the {@code Integer} value of the system property identified by {@code string}. Returns {@code null} if {@code string} is {@code null} or empty, if the property can not be found or if its value can not be parsed as an integer.
 public static Integer getInteger(String string,
    int defaultValue) 
    Returns the {@code Integer} value of the system property identified by {@code string}. Returns the specified default value if {@code string} is {@code null} or empty, if the property can not be found or if its value can not be parsed as an integer.
 public static Integer getInteger(String string,
    Integer defaultValue) 
    Returns the {@code Integer} value of the system property identified by {@code string}. Returns the specified default value if {@code string} is {@code null} or empty, if the property can not be found or if its value can not be parsed as an integer.
 public int hashCode() 
 public static int highestOneBit(int i) 
    Determines the highest (leftmost) bit of the specified integer that is 1 and returns the bit mask value for that bit. This is also referred to as the Most Significant 1 Bit. Returns zero if the specified integer is zero.
 public int intValue() 
    Gets the primitive value of this int.
 public long longValue() 
 public static int lowestOneBit(int i) 
    Determines the lowest (rightmost) bit of the specified integer that is 1 and returns the bit mask value for that bit. This is also referred to as the Least Significant 1 Bit. Returns zero if the specified integer is zero.
 public static int numberOfLeadingZeros(int i) 
    Determines the number of leading zeros in the specified integer prior to the highest one bit .
 public static int numberOfTrailingZeros(int i) 
    Determines the number of trailing zeros in the specified integer after the lowest one bit .
 public static int parseInt(String string) throws NumberFormatException 
    Parses the specified string as a signed decimal integer value. The ASCII character \u002d ('-') is recognized as the minus sign.
 public static int parseInt(String string,
    int radix) throws NumberFormatException 
    Parses the specified string as a signed integer value using the specified radix. The ASCII character \u002d ('-') is recognized as the minus sign.
 public static int reverse(int i) 
    Reverses the order of the bits of the specified integer.
 public static int reverseBytes(int i) 
    Reverses the order of the bytes of the specified integer.
 public static int rotateLeft(int i,
    int distance) 
    Rotates the bits of the specified integer to the left by the specified number of bits.
 public static int rotateRight(int i,
    int distance) 
    Rotates the bits of the specified integer to the right by the specified number of bits.
 public short shortValue() 
 public static int signum(int i) 
    Returns the value of the {@code signum} function for the specified integer.
 public static String toBinaryString(int i) 
    Converts the specified integer into its binary string representation. The returned string is a concatenation of '0' and '1' characters.
 public static String toHexString(int i) 
    Converts the specified integer into its hexadecimal string representation. The returned string is a concatenation of characters from '0' to '9' and 'a' to 'f'.
 public static String toOctalString(int i) 
    Converts the specified integer into its octal string representation. The returned string is a concatenation of characters from '0' to '7'.
 public String toString() 
 public static String toString(int value) 
    Converts the specified integer into its decimal string representation. The returned string is a concatenation of a minus sign if the number is negative and characters from '0' to '9'.
 public static String toString(int i,
    int radix) 
    Converts the specified integer into a string representation based on the specified radix. The returned string is a concatenation of a minus sign if the number is negative and characters from '0' to '9' and 'a' to 'z', depending on the radix. If {@code radix} is not in the interval defined by {@code Character.MIN_RADIX} and {@code Character.MAX_RADIX} then 10 is used as the base for the conversion.
 public static Integer valueOf(String string) throws NumberFormatException 
    Parses the specified string as a signed decimal integer value.
 public static Integer valueOf(int i) 
    Returns a {@code Integer} instance for the specified integer value.

    If it is not necessary to get a new {@code Integer} instance, it is recommended to use this method instead of the constructor, since it maintains a cache of instances which may result in better performance.

 public static Integer valueOf(String string,
    int radix) throws NumberFormatException 
    Parses the specified string as a signed integer value using the specified radix.