| java.lang.Object | ||
| ↳ | java.lang.Number | |
| ↳ | java.lang.Long | |
Long is the wrapper for the primitive type long.
As with the specification, this implementation relied on code laid out in Henry S. Warren, Jr.'s Hacker's Delight, (Addison Wesley, 2002) as well as The Aggregate's Magic Algorithms.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| long | MAX_VALUE |
Constant for the maximum |
|||||||||
| long | MIN_VALUE |
Constant for the minimum |
|||||||||
| int | SIZE |
Constant for the number of bits to represent a |
|||||||||
| Class<Long> | TYPE | The java.lang.Class that represents this class. | |||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new instance of the receiver which represents the long
valued argument.
| |||||||||||
Constructs a new instance of this class given a string.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Counts the number of 1 bits in the | |||||||||||
Returns the byte value which the receiver represents
| |||||||||||
Compares this | |||||||||||
Parses the string argument as if it was a long value and returns the
result.
| |||||||||||
Returns the double value which the receiver represents
| |||||||||||
Compares the argument to the receiver, and returns true if they represent
the same object using a class specific comparison.
| |||||||||||
Returns the float value which the receiver represents
| |||||||||||
Returns an Long representing the long value of the property named by the
argument.
| |||||||||||
Returns a Long representing the long value of the property named by the
argument.
| |||||||||||
Returns a Long representing the long value of the property named by the
argument.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Determines the highest (leftmost) bit that is 1 and returns the value that is the bit mask for that bit. | |||||||||||
Returns the int value which the receiver represents
| |||||||||||
Returns the long value which the receiver represents
| |||||||||||
Determines the lowest (rightmost) bit that is 1 and returns the value that is the bit mask for that bit. | |||||||||||
Determines the number of leading zeros in the | |||||||||||
Determines the number of trailing zeros in the | |||||||||||
Parses the string argument as if it was an long value and returns the
result.
| |||||||||||
Parses the string argument as if it was a long value and returns the
result.
| |||||||||||
Reverses the bytes of a | |||||||||||
Reverses the bytes of a | |||||||||||
Rotates the bits of | |||||||||||
Rotates the bits of | |||||||||||
Returns the short value which the receiver represents
| |||||||||||
The | |||||||||||
Returns a string containing '0' and '1' characters which describe the
binary representation of the argument.
| |||||||||||
Returns a string containing characters in the range 0..7, a..f which
describe the hexadecimal representation of the argument.
| |||||||||||
Returns a string containing characters in the range 0..7 which describe
the octal representation of the argument.
| |||||||||||
Returns a string containing characters in the range 0..9, a..z (depending
on the radix) which describe the representation of the argument in that
radix.
| |||||||||||
Returns a string containing a concise, human-readable description of the
receiver.
| |||||||||||
Returns a string containing characters in the range 0..9 which describe
the decimal representation of the argument.
| |||||||||||
Parses the string argument as if it was an long value and returns the
result.
| |||||||||||
Parses the string argument as if it was an long value and returns the
result.
| |||||||||||
Returns a | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Number
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.lang.Comparable
| |||||||||||
Constant for the maximum long value, 263-1.
Constant for the minimum long value, -231.
Constant for the number of bits to represent a long in
two's compliment form.
Constructs a new instance of the receiver which represents the long valued argument.
| value | the long to store in the new instance. |
|---|
Constructs a new instance of this class given a string.
| string | a string representation of an long quantity. |
|---|
| NumberFormatException | if the argument could not be parsed as a long quantity. |
|---|
Counts the number of 1 bits in the long value passed; this
is sometimes referred to as a population count.
| lng | The long value to process. |
|---|
Returns the byte value which the receiver represents
Compares this Long to the Long passed. If
this instance's value is equal to the value of the instance passed, then
0 is returned. If this instance's value is less than the value of the
instance passed, then a negative value is returned. If this instance's
value is greater than the value of the instance passed, then a positive
value is returned.
| object | The instance to compare to. |
|---|
| NullPointerException | if object is null. |
|---|
Parses the string argument as if it was a long value and returns the result. Throws NumberFormatException if the string does not represent a long quantity. The string may be a hexadecimal ("0x..."), octal ("0..."), or decimal ("...") representation of a long.
| string | a string representation of an long quantity. |
|---|
| NumberFormatException | if the argument could not be parsed as an long quantity. |
|---|
Returns the double value which the receiver represents
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
In this case, the argument must also be an Long, and the receiver and argument must represent the same long value.
| o | the object to compare with this object |
|---|
true if the object is the same as this object
false if it is different from this objectReturns the float value which the receiver represents
Returns an Long representing the long value of the property named by the argument. If the property could not be found, or its value could not be parsed as an long, answer the second argument.
| string | The name of the desired long property. |
|---|
Returns a Long representing the long value of the property named by the argument. If the property could not be found, or its value could not be parsed as a long, answer a Long representing the second argument.
| string | The name of the desired long property. |
|---|
Returns a Long representing the long value of the property named by the argument. If the property could not be found, or its value could not be parsed as a long, answer null.
| string | The name of the desired integer property. |
|---|
Returns an integer hash code for the receiver. Any two objects which
answer true when passed to equals must
answer the same value for this method.
Determines the highest (leftmost) bit that is 1 and returns the value that is the bit mask for that bit. This is sometimes referred to as the Most Significant 1 Bit.
| lng | The long to interrogate. |
|---|
Returns the int value which the receiver represents
Returns the long value which the receiver represents
Determines the lowest (rightmost) bit that is 1 and returns the value that is the bit mask for that bit. This is sometimes referred to as the Least Significant 1 Bit.
| lng | The long to interrogate. |
|---|
Determines the number of leading zeros in the long passed
prior to the highest one bit.
| lng | The long to process. |
|---|
Determines the number of trailing zeros in the long passed
after the lowest one bit.
| lng | The long to process. |
|---|
Parses the string argument as if it was an long value and returns the result. Throws NumberFormatException if the string does not represent an long quantity. The second argument specifies the radix to use when parsing the value.
| string | a string representation of an long quantity. |
|---|---|
| radix | the base to use for conversion. |
| NumberFormatException | if the argument could not be parsed as an long quantity. |
|---|
Parses the string argument as if it was a long value and returns the result. Throws NumberFormatException if the string does not represent a long quantity.
| string | a string representation of a long quantity. |
|---|
| NumberFormatException | if the argument could not be parsed as a long quantity. |
|---|
Reverses the bytes of a long.
| lng | The long to reverse. |
|---|
Reverses the bytes of a long.
| lng | The long to reverse. |
|---|
Rotates the bits of lng to the left by the
distance bits.
| lng | The long value to rotate left. |
|---|---|
| distance | The number of bits to rotate. |
Rotates the bits of lng to the right by the
distance bits.
| lng | The long value to rotate right. |
|---|---|
| distance | The number of bits to rotate. |
Returns the short value which the receiver represents
The signum function for long values. This
method returns -1 for negative values, 1 for positive values and 0 for
the value 0.
| lng | The long value. |
|---|
Returns a string containing '0' and '1' characters which describe the binary representation of the argument.
| l | a long to get the binary representation of |
|---|
Returns a string containing characters in the range 0..7, a..f which describe the hexadecimal representation of the argument.
| l | a long to get the hex representation of |
|---|
Returns a string containing characters in the range 0..7 which describe the octal representation of the argument.
| l | a long to get the octal representation of |
|---|
Returns a string containing characters in the range 0..9, a..z (depending on the radix) which describe the representation of the argument in that radix.
| l | a long to get the representation of |
|---|---|
| radix | the base to use for conversion. |
Returns a string containing a concise, human-readable description of the receiver.
Returns a string containing characters in the range 0..9 which describe the decimal representation of the argument.
| l | a long to get the representation of |
|---|
Parses the string argument as if it was an long value and returns the result. Throws NumberFormatException if the string does not represent an long quantity. The second argument specifies the radix to use when parsing the value.
| string | a string representation of an long quantity. |
|---|---|
| radix | the base to use for conversion. |
| NumberFormatException | if the argument could not be parsed as an long quantity. |
|---|
Parses the string argument as if it was an long value and returns the result. Throws NumberFormatException if the string does not represent an long quantity.
| string | a string representation of an long quantity. |
|---|
| NumberFormatException | if the argument could not be parsed as an long quantity. |
|---|
Returns a Long instance for the long value
passed. This method is preferred over the constructor, as this method may
maintain a cache of instances.
| lng | The long value. |
|---|
Long instance.