You have taken the quote out of context. The full context is this:

64-bit Java

How is native code affected?

...

When porting 32-bit native code to 64-bit Java platforms, you will need to modify you code to be 64-bit clean. This involves examining your C/C+ + code and looking for code that assumes the size of a pointer to be 4 bytes or that a pointer can be cast and stored in an integer. Long data types are also troublesome when porting 32-bit code. You should avoid the use of longs if at all possible since longs have different sizes on different operating systems even in 64-bit. Windows 64-bit platforms define longs to be 4 bytes but most Unix operating systems specify that longs are 8 bytes in size. For more details, refer to the links below under learning more about 64-bit programming.

To answer your questions:

Java size of long type?

The Java long type is 64 bits on all platforms.

What does this quote mean?

It is self evident, but it is clearly NOT referring the the Java long type. It is referring to the use of the C or C++ long type in native code.

When I want to store value more than ~2^31, how JVM store this value?

In Java code, use long. It works. The JVM implementation takes care of it in different ways on different platforms. Don't worry about it.

In C / C++ native code you have a problem if you want your code to be portable. But the original article provides you with links to help you get your head around the problem.

In calculations, JVM use RAX, or EAX register?

The Java language specification requires that long has a 64 bit (no less, no more) representation, and that all long op long arithmetic is performed with at least 64 bits of precision so that the answer is the same on all platforms.

The actual implementation depends on the platform. The JVM / JIT compiler will (most likely) chose registers and instructions that are most efficient for the current platform.

Bear in mind that the JVM you run on a 32 bit Windows Intel platform is different to one for a 64 bit Windows Intel platform, or Solaris, ARM, and so on. For many of those platforms there are no registers called RAX and EAX.

But if you really need to know, look at the source code, or use the JVM option for dumping the native code emitted by the JIT compiler.

Answer from Stephen C on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ difference-between-byte-short-int-and-long-datatype-in-java
Difference Between byte, short, int and long Datatype in Java - GeeksforGeeks
July 23, 2025 - Among these, the integer data types are byte, short, long, and int. The integer data types are used to store numeric values. In this article, we will discuss the difference between these four Integer data-types. JAVA does not support an unsigned version of these integer data types. The main basis of difference is size and range.
๐ŸŒ
DataCamp
datacamp.com โ€บ doc โ€บ java โ€บ java-data-types
Java Data Types
There are eight primitive data ... int: Size: 32-bit ยท Range: -231 to 231-1 ยท Usage: Default choice for integer values. int i = 100000; long: Size: 64-bit ยท...
Discussions

jvm - Java size of long type - Stack Overflow
On Oracle.com I have read: You should avoid the use of longs if at all possible since longs have different sizes on different operating systems even in 64-bit. Windows 64-bit platforms define l... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Which is larger? Long vs Double
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
๐ŸŒ r/javahelp
10
3
January 19, 2023
[Java] Size of a long?
Instead of thinking about bytes, think about bits (noting that 8 bits = 1 byte). So a long is 64 bits, and so in base 2, you would need 64 zeroes and ones to represent a long. Since 4 bits can be represented in a hexadecimal digit, you would need 16 hexadecimal digits to represent 64 bits. More on reddit.com
๐ŸŒ r/learnprogramming
15
1
November 25, 2016
Java Beginner: Confused on why "L" is needed at the end of a long value
Surely the compiler should know using the datatype declaration at the beginning of the statement alone? The data type declaration and the number literal are interpreted separately, so the compiler can't infer the data type when considering the number literal. Even if it could do this, there are many cases where there isn't a declared data type that the compiler could rely on. (such as when used as a method argument, or when a number literal is used in a larger expression). So the language needs some unambiguous way for the programmer to say that "this number is a long", or "this number is a float", or "this number is a double". More on reddit.com
๐ŸŒ r/javahelp
13
13
June 30, 2020
๐ŸŒ
Oracle
docs.oracle.com โ€บ javase โ€บ tutorial โ€บ java โ€บ nutsandbolts โ€บ datatypes.html
Primitive Data Types (The Javaโ„ข Tutorials > Learning the Java Language > Language Basics)
The signed long has a minimum value of -263 and a maximum value of 263-1. In Java SE 8 and later, you can use the long data type to represent an unsigned 64-bit long, which has a minimum value of 0 and a maximum value of 264-1. Use this data type when you need a range of values wider than those ...
๐ŸŒ
JA-VA Code
java-performance.info โ€บ home โ€บ java: byte, short, int, long, char, boxing/unboxing
Long to Integer Java: A Practical Guide
September 25, 2023 - The byte data type is the smallest integer type in Java, occupying just 8 bits (1 byte). Despite its size, it packs quite a punch when it comes to memory efficiency. It can hold values ranging from -128 to 127.
Top answer
1 of 1
4

You have taken the quote out of context. The full context is this:

64-bit Java

How is native code affected?

...

When porting 32-bit native code to 64-bit Java platforms, you will need to modify you code to be 64-bit clean. This involves examining your C/C+ + code and looking for code that assumes the size of a pointer to be 4 bytes or that a pointer can be cast and stored in an integer. Long data types are also troublesome when porting 32-bit code. You should avoid the use of longs if at all possible since longs have different sizes on different operating systems even in 64-bit. Windows 64-bit platforms define longs to be 4 bytes but most Unix operating systems specify that longs are 8 bytes in size. For more details, refer to the links below under learning more about 64-bit programming.

To answer your questions:

Java size of long type?

The Java long type is 64 bits on all platforms.

What does this quote mean?

It is self evident, but it is clearly NOT referring the the Java long type. It is referring to the use of the C or C++ long type in native code.

When I want to store value more than ~2^31, how JVM store this value?

In Java code, use long. It works. The JVM implementation takes care of it in different ways on different platforms. Don't worry about it.

In C / C++ native code you have a problem if you want your code to be portable. But the original article provides you with links to help you get your head around the problem.

In calculations, JVM use RAX, or EAX register?

The Java language specification requires that long has a 64 bit (no less, no more) representation, and that all long op long arithmetic is performed with at least 64 bits of precision so that the answer is the same on all platforms.

The actual implementation depends on the platform. The JVM / JIT compiler will (most likely) chose registers and instructions that are most efficient for the current platform.

Bear in mind that the JVM you run on a 32 bit Windows Intel platform is different to one for a 64 bit Windows Intel platform, or Solaris, ARM, and so on. For many of those platforms there are no registers called RAX and EAX.

But if you really need to know, look at the source code, or use the JVM option for dumping the native code emitted by the JIT compiler.

Find elsewhere
๐ŸŒ
Quora
quora.com โ€บ What-is-the-difference-between-byte-short-int-and-long-in-Java
What is the difference between byte, short, int, and long in Java? - Quora
Answer (1 of 3): These are consider as a data type in java Byte can hold 8 bit Short can hold 16 bit Int can hold 32 bit Long can hold 64 bit
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ java_data_types.asp
Java Data Types
assert abstract boolean break byte case catch char class continue default do double else enum exports extends final finally float for if implements import instanceof int interface long module native new package private protected public return requires short static super switch synchronized this throw throws transient try var void volatile while Java String Methods
๐ŸŒ
Datacadamia
datacadamia.com โ€บ lang โ€บ java โ€บ long
Java - long - Long (integer 64 bit)
August 30, 2024 - In Java, the long data type stores integer on 64 bit while the integer data type stores integer on 32bit. The primitive wrapper java/lang/LongLong is a subclass of java/lang/NumberNumber in java Long is an integer that is encoded with 64 bit but you have also int on 32 bit.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ stdtypes.html
Built-in Types โ€” Python 3.14.3 documentation
1 week ago - The advantage of the range type over a regular list or tuple is that a range object will always take the same (small) amount of memory, no matter the size of the range it represents (as it only stores the start, stop and step values, calculating individual items and subranges as needed).
๐ŸŒ
Oracle
docs.oracle.com โ€บ javase โ€บ 8 โ€บ docs โ€บ api โ€บ java โ€บ lang โ€บ Long.html
Long (Java Platform SE 8 )
October 20, 2025 - Parses the string argument as an unsigned decimal long. The characters in the string must all be decimal digits, except that the first character may be an an ASCII plus sign '+' ('\u002B'). The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseUnsignedLong(java.lang.String, int) method.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ java-data-types
Java Data Types - GeeksforGeeks
Size : 4 bytes ( 32 bits ) Java ... used when int is not sufficient for large values. Syntax: long longVar; Size : 8 bytes (64 bits) Java ยท...
Published ย  January 16, 2026
๐ŸŒ
Substack
alexanderobregon.substack.com โ€บ p โ€บ median-of-a-data-stream-with-two
Median of a Data Stream with Two Heaps in Java
3 days ago - Size checks decide which case applies, then peek() pulls the boundary values without changing heap contents. The even-count case casts to long before the add, which avoids overflow when two large int values are summed, and the / 2.0 keeps the return type as double so midpoints like 2.5 stay accurate.
๐ŸŒ
Codementor
codementor.io โ€บ community โ€บ primitive data types in java: understand the core essentials
Primitive Data Types In Java: Understand The Core Essentials | Codementor
March 22, 2024 - long myLong = 2147483648L; long myOtherLong = 2147483649l; For handling decimal numbers, Java offers two primitive data types: float and double.
๐ŸŒ
Processing
processing.org โ€บ reference โ€บ long.html
long / Reference / Processing.org
While integers can be as large as 2,147,483,647 and as low as -2,147,483,648 (stored as 32 bits), a long integer has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (stored as 64 bits).
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_data_types_extended.php
C More Data Types (Extended Types)
*Note: The size of these types can differ between systems (for example, 2 or 4 bytes, or 4 or 8 bytes), depending on whether the computer is older or newer, 32-bit or 64-bit, and which compiler is used.
๐ŸŒ
Quora
quora.com โ€บ Q1-What-is-the-size-of-the-int-data-type-in-Java
Q1.What is the size of the int data type in Java? - Quora
Answer (1 of 7): The size of the int data type in java is 4. In java,it is a type of Integral data type. int data type has wide range of uses. The range of int data type in java is -2,147,483,648 to 2,147,483,648. The int data type in java is, ...