1. Which byte order(Little Endian or Big Endian) JVM uses?
Java used network byte order (which is big endian)
Lets say there are four memory addresses for lower to higher: 1000, 1001, 1002, 1003
and an integer of 32 bits(4 bytes) needs to be stored in these addresses.
integer in HEX format is: 10 AB 5B H4
Little Endian: Least significant byte will be stored in smallest address.
So value - address mapping will be: 10 > 1003, AB > 1002, 5B > 1001, H4 > 1000
Big Endian: Most significant byte will be stored in smallest address.
So value - address mapping will be: 10 > 1000, AB > 1001, 5B > 1002, H4 > 1003
Java used network byte order (which is big endian)
Lets say there are four memory addresses for lower to higher: 1000, 1001, 1002, 1003
and an integer of 32 bits(4 bytes) needs to be stored in these addresses.
integer in HEX format is: 10 AB 5B H4
Little Endian: Least significant byte will be stored in smallest address.
So value - address mapping will be: 10 > 1003, AB > 1002, 5B > 1001, H4 > 1000
Big Endian: Most significant byte will be stored in smallest address.
So value - address mapping will be: 10 > 1000, AB > 1001, 5B > 1002, H4 > 1003
No comments:
Post a Comment