First of all, if int a and int b are continuously stored in the stack, then the memory address of b must be 4 bytes larger than the address of a, not 1 byte!
As for big endian mode or little endian mode, let’s start with binary. The minimum storage unit of data in the stack is bytes, and the storage in bytes is fixed in little endian mode!
The same hexadecimal data 0x3F00 is stored in the order 00 3F in the little endian mode, and in the big endian mode the storage order is 3F 00. To put it bluntly, it means whether the low-order bytes are stored first or the high-order bytes are stored first.
The storage mode of Java is related to the computer's CPU, but regardless of big-endian or little-endian, the storage mode and analysis are also opposite. That is to say, the calculation result of the same int is the same regardless of big-endian or little-endian storage.
Please correct me if there are any errors or omissions in your answer
I looked at other pictures in this article, and the pictures involving
操作数栈
are all from bottom to topFirst of all, if int a and int b are continuously stored in the stack, then the memory address of b must be 4 bytes larger than the address of a, not 1 byte!
As for big endian mode or little endian mode, let’s start with binary. The minimum storage unit of data in the stack is bytes, and the storage in bytes is fixed in little endian mode!
The same hexadecimal data 0x3F00 is stored in the order 00 3F in the little endian mode, and in the big endian mode the storage order is 3F 00. To put it bluntly, it means whether the low-order bytes are stored first or the high-order bytes are stored first.
The storage mode of Java is related to the computer's CPU, but regardless of big-endian or little-endian, the storage mode and analysis are also opposite. That is to say, the calculation result of the same int is the same regardless of big-endian or little-endian storage.
Please correct me if there are any errors or omissions in your answer