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) Copy after login | ##Static method 0 x == y; -1 x < y; 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 long parseLong(String s, int radix) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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!
Related labels:
source:php.cn
Previous article:Java implements conversion between images and base64 encoding (example)
Next article:Implementation code of scheduled task scheduling in springboot
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
Related Topics
More>
|