Long

Constructors

this
this(long value)

Constructs a newly allocated {@code Long} object that represents the specified {@code long} argument.

this
this(string s)

Constructs a newly allocated {@code Long} object that represents the {@code long} value indicated by the {@code string} parameter. The string is converted to a {@code long} value in exactly the manner used by the {@code parseLong} method for radix 10.

Members

Functions

opCmp
int opCmp(Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
opCmp
int opCmp(long n)
Undocumented in source. Be warned that the author may not have intended to support it.
toHash
size_t toHash()

Returns a hash code for a {@code long} value; compatible with {@code Long.hashCode()}.

Manifest constants

BYTES
enum BYTES;

The number of bytes used to represent a {@code long} value in two's complement binary form.

Static functions

bitCount
int bitCount(long i)

Returns the number of one-bits in the two's complement binary representation of the specified {@code long} value. This function is sometimes referred to as the <i>population count</i>.

formatUnsignedLong
int formatUnsignedLong(long val, int shift, char[] buf, int offset, int len)

Format a long (treated as unsigned) into a character buffer. @param val the unsigned long to format @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary) @param buf the character buffer to write to @param offset the offset in the destination buffer to start at @param len the number of characters to write @return the lowest character location used

numberOfLeadingZeros
int numberOfLeadingZeros(long i)

Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified {@code long} value. Returns 64 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.

numberOfTrailingZeros
int numberOfTrailingZeros(long i)

Returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specified {@code long} value. Returns 64 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.

parseLong
long parseLong(string s, int radix)
Undocumented in source. Be warned that the author may not have intended to support it.
reverseBytes
long reverseBytes(long i)

Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified {@code long} value.

signum
int signum(long i)

Returns the signum function of the specified {@code long} value. (The return value is -1 if the specified value is negative; 0 if the specified value is zero; and 1 if the specified value is positive.)

toBinaryString
string toBinaryString(long i)

Returns a string representation of the {@code long} argument as an unsigned integer in base&nbsp;2.

toHexString
string toHexString(long i)

Returns a string representation of the {@code long} argument as an unsigned integer in base&nbsp;16.

toOctalString
string toOctalString(long i)

Returns a string representation of the {@code long} argument as an unsigned integer in base&nbsp;8.

toStr
string toStr(long i, int radix)

Returns a string representation of the first argument in the radix specified by the second argument.

toUnsignedString
string toUnsignedString(long i, int radix)

Returns a string representation of the first argument as an unsigned integer value in the radix specified by the second argument.

toUnsignedString0
string toUnsignedString0(long val, int shift)

Format a long (treated as unsigned) into a string. @param val the value to format @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary)

valueOf
Long valueOf(long l)

Returns a {@code Long} instance representing the specified {@code long} value. If a new {@code Long} instance is not required, this method should generally be used in preference to the constructor {@link #Long(long)}, as this method is likely to yield significantly better space and time performance by caching frequently requested values.

valueOf
Long valueOf(string s, int radix)

Returns a {@code Long} object holding the value extracted from the specified {@code String} when parsed with the radix given by the second argument. The first argument is interpreted as representing a signed {@code long} in the radix specified by the second argument, exactly as if the arguments were given to the {@link #parseLong(java.lang.String, int)} method. The result is a {@code Long} object that represents the {@code long} value specified by the string.

valueOf
Long valueOf(string s)

Returns a {@code Long} object holding the value of the specified {@code String}. The argument is interpreted as representing a signed decimal {@code long}, exactly as if the argument were given to the {@link #parseLong(java.lang.String)} method. The result is a {@code Long} object that represents the integer value specified by the string.

Static variables

MAX_VALUE
long MAX_VALUE;

A constant holding the maximum value a {@code long} can have, 2<sup>63</sup>-1.

MIN_VALUE
long MIN_VALUE;

A constant holding the minimum value a {@code long} can have, -2<sup>63</sup>.

Variables

SIZE
enum int SIZE;

The number of bits used to represent a {@code long} value in two's complement binary form.

Meta