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

All Implemented Interfaces:
    Comparable, Serializable

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

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  Long.valueOfCache   
Field Summary
public static final  long MAX_VALUE    Constant for the maximum {@code long} value, 263-1. 
public static final  long MIN_VALUE    Constant for the minimum {@code long} value, -263
public static final  Class<Long> TYPE    The Class object that represents the primitive type {@code long}. 
public static final  int SIZE    Constant for the number of bits needed to represent a {@code long} in two's complement form.
    since: 1.5 -
 
Constructor:
 public Long(long value) 
 public Long(String string) throws NumberFormatException 
    Constructs a new {@code Long} from the specified string.
    Parameters:
    string - the string representation of a long value.
    Throws:
    NumberFormatException - if {@code string} can not be decoded into a long value.
    Also see:
    parseLong(String)
Method from java.lang.Long Summary:
bitCount,   byteValue,   compareTo,   decode,   doubleValue,   equals,   floatValue,   getLong,   getLong,   getLong,   hashCode,   highestOneBit,   intValue,   longValue,   lowestOneBit,   numberOfLeadingZeros,   numberOfTrailingZeros,   parseLong,   parseLong,   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.Long Detail:
 public static int bitCount(long lng) 
    Counts the number of 1 bits in the specified long value; this is also referred to as population count.
 public byte byteValue() 
 public int compareTo(Long object) 
    Compares this object to the specified long object to determine their relative order.
 public static Long decode(String string) throws NumberFormatException 
    Parses the specified string and returns a {@code Long} instance if the string can be decoded into a long value. The string may be an optional minus sign "-" followed by a hexadecimal ("0x..." or "#..."), octal ("0..."), or decimal ("...") representation of a long.
 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 Long} and have the same long value as this object.
 public float floatValue() 
 public static Long getLong(String string) 
    Returns the {@code Long} 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 a long.
 public static Long getLong(String string,
    long defaultValue) 
    Returns the {@code Long} 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 a long.
 public static Long getLong(String string,
    Long defaultValue) 
    Returns the {@code Long} 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 a long.
 public int hashCode() 
 public static long highestOneBit(long lng) 
    Determines the highest (leftmost) bit of the specified long value 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 long is zero.
 public int intValue() 
 public long longValue() 
    Gets the primitive value of this long.
 public static long lowestOneBit(long lng) 
    Determines the lowest (rightmost) bit of the specified long value 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 long is zero.
 public static int numberOfLeadingZeros(long lng) 
    Determines the number of leading zeros in the specified long value prior to the highest one bit .
 public static int numberOfTrailingZeros(long lng) 
    Determines the number of trailing zeros in the specified long value after the lowest one bit .
 public static long parseLong(String string) throws NumberFormatException 
    Parses the specified string as a signed decimal long value. The ASCII character \u002d ('-') is recognized as the minus sign.
 public static long parseLong(String string,
    int radix) throws NumberFormatException 
    Parses the specified string as a signed long value using the specified radix. The ASCII character \u002d ('-') is recognized as the minus sign.
 public static long reverse(long lng) 
    Reverses the order of the bits of the specified long value.
 public static long reverseBytes(long lng) 
    Reverses the order of the bytes of the specified long value.
 public static long rotateLeft(long lng,
    int distance) 
    Rotates the bits of the specified long value to the left by the specified number of bits.
 public static long rotateRight(long lng,
    int distance) 

    Rotates the bits of the specified long value to the right by the specified number of bits.

 public short shortValue() 
 public static int signum(long lng) 
    Returns the value of the {@code signum} function for the specified long value.
 public static String toBinaryString(long l) 
    Converts the specified long value into its binary string representation. The returned string is a concatenation of '0' and '1' characters.
 public static String toHexString(long l) 
    Converts the specified long value 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(long l) 
    Converts the specified long value into its octal string representation. The returned string is a concatenation of characters from '0' to '7'.
 public String toString() 
 public static String toString(long l) 
    Converts the specified long value 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(long l,
    int radix) 
    Converts the specified long value 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 Long valueOf(String string) throws NumberFormatException 
    Parses the specified string as a signed decimal long value.
 public static Long valueOf(long lng) 
    Returns a {@code Long} instance for the specified long value.

    If it is not necessary to get a new {@code Long} 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 Long valueOf(String string,
    int radix) throws NumberFormatException 
    Parses the specified string as a signed long value using the specified radix.