📅  最后修改于: 2020-11-15 03:01:55             🧑  作者: Mango
java.lang.Long类将一个基本类型的值包装在一个对象中。 Long类型的对象包含一个long类型的字段。
以下是java.lang.Long类的声明-
public final class Long
extends Number
implements Comparable
以下是java.lang.Long类的字段-
静态长整数MAX_VALUE-这是一个常数,用于保存长整数可以具有的最大值2 63 -1。
静态长整数MIN_VALUE-这是一个常数,保持长整数可以具有的最小值-2 63 。
静态整数SIZE-这是用来表示二进制补码二进制形式的长值的位数。
静态Class
Sr.No. | Constructor & Description |
---|---|
1 |
Long(long value) This constructs a newly allocated Long object that represents the specified long argument. |
2 |
Long(String s) This constructs a newly allocated Long object that represents the long value indicated by the String parameter. |
Sr.No. | Method & Description |
---|---|
1 | static int bitCount(long i)
This method returns the number of one-bits in the two’s complement binary representation of the specified long value. |
2 | byte byteValue()
This method returns the value of this Long as a byte. |
3 | int compareTo(Long anotherLong)
This method compares two Long objects numerically. |
4 | static Long decode(String nm)
This method decodes a String into a Long. |
5 | double doubleValue()
This method returns the value of this Long as a double. |
6 | boolean equals(Object obj)
This method compares this object to the specified object. |
7 | float floatValue()
This method returns the value of this Long as a float. |
8 | static Long getLong(String nm)
This method determines the long value of the system property with the specified name. |
9 | static Long getLong(String nm, long val)
This method determines the long value of the system property with the specified name. |
10 | static Long getLong(String nm, Long val)
This method returns the long value of the system property with the specified name. |
11 | int hashCode()
This method returns a hash code for this Long. |
12 | static long highestOneBit(long i)
This method returns a long value with at most a single one-bit, in the position of the highest-order (“leftmost”) one-bit in the specified long value. |
13 | int intValue()
This method returns the value of this Long as an int. |
14 | long longValue()
This method returns the value of this Long as a long value. |
15 | static long lowestOneBit(long i)
This method returns a long value with at most a single one-bit, in the position of the lowest-order (“rightmost”) one-bit in the specified long value. |
16 | static int numberOfLeadingZeros(long i)
This method returns the number of zero bits preceding the highest-order (“leftmost”) one-bit in the two’s complement binary representation of the specified long value. |
17 | static int numberOfTrailingZeros(long i)
This method returns the number of zero bits following the lowest-order (“rightmost”) one-bit in the two’s complement binary representation of the specified long value. |
18 | static long parseLong(String s)
This method parses the string argument as a signed decimal long. |
19 | static long parseLong(String s, int radix)
This method parses the string argument as a signed long in the radix specified by the second argument. |
20 | static long reverse(long i)
This method returns the value obtained by reversing the order of the bits in the two’s complement binary representation of the specified long value. |
21 | static long reverseBytes(long i)
This method returns the value obtained by reversing the order of the bytes in the two’s complement representation of the specified long value. |
22 | static long rotateLeft(long i, int distance)
This method returns the value obtained by rotating the two’s complement binary representation of the specified long value left by the specified number of bits. |
23 | static long rotateRight(long i, int distance)
This method returns the value obtained by rotating the two’s complement binary representation of the specified long value right by the specified number of bits. |
24 | short shortValue()
This method returns the value of this Long as a short. |
25 | static int signum(long i)
This method returns the signum function of the specified long value. |
26 | static String toBinaryString(long i)
This method returns a string representation of the long argument as an unsigned integer in base 2. |
27 | static String toHexString(long i)
This method returns a string representation of the long argument as an unsigned integer in base 16. |
28 | static String toOctalString(long i)
This method returns a string representation of the long argument as an unsigned integer in base 8. |
29 | String toString()
This method returns a String object representing this Long’s value. |
30 | static String toString(long i)
This method returns a String object representing the specified long. |
31 | static String toString(long i, int radix)
This method returns a string representation of the first argument in the radix specified by the second argument. |
32 | static Long valueOf(long l)
This method returns a Long instance representing the specified long value. |
33 | static Long valueOf(String s)
This method returns a Long object holding the value of the specified String. |
34 | static Long valueOf(String s, int radix)
This method returns a Long object holding the value extracted from the specified String when parsed with the radix given by the second argument. |
此类从以下类继承方法-