This article brings you a detailed analysis of the Java data type Long. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Long
Long The wrapper class of the basic data type long
Long type The object contains a long type field
Property Introduction
A constant whose value is 263-1, which represents the maximum value that the long type can represent | @Native public static final long MAX_VALUE = 0x7ffffffffffffffffL; |
is a constant with a value of -263, which represents the smallest value that the long type can represent Value | @Native public static final long MIN_VALUE = 0x8000000000000000L; |
is used to The two's complement form represents the number of bits of the long value | @Native public static final int SIZE = 64; |
The two's complement form represents the number of bytes of the long value | public static final int BYTES = SIZE / Byte.SIZE; |
Represents a Class instance of the basic type long | public static final Class |
##Construction method
Construction methods are to create new objects and allocate new space
Constructed in string form, parsed in decimal string form by default
Packaging classUse the corresponding basic data type long to construct |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
##Packaging class Constructed using the String form of the corresponding basic data type long
|
static int compare(long x, long y) |
##Static method 0 x == y; -1 x 1 x > y
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Instance methodCompare two objects, actually compare the value of the two objects Basically still call static int compare(long x, long y) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Static methodTwo basic types of int are compared as unsigned numbers and converted through MIN_VALUEIt is still called static int compare(long x, long y) |
static long parseLong(String s, int radix) |
Static methodUse the base (base) specified by the second parameter to parse the string parameter into a signed integer Except that the first character can be the ASCII minus sign '-' ('\u002D') and the plus sign ' ' ('\u002B') used to represent negative values The characters in the string must be specified The number of the base |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static Decimal simplified form of method static long parseLong(String s, int radix) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Static method
Use the second one The base (base) specified by the parameter, parses the string parameter into an unsigned integer except that the first character can be an ASCII plus sign ' ' ( '\u002B') External The characters in the string must be numbers in the specified base
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
valueOf series Pack basic basic types into objects Used to create and obtain objects , so there is no need for objects, they are all static methods
##The VaueOf series has a corresponding cache area, and objects within the cache area For the same buffer is an array in a static inner class # #The buffer range is -128~127
|
The above is the detailed content of Detailed analysis of Java data type Long. For more information, please follow other related articles on the PHP Chinese website!