A program running on a modern operating system thinks that it has a large, contiguous allotment of memory: 2 gigabytes in the case of 32-bit editions of Windows and Linux, 8 terabytes or more for x64 editions (limited both by the operating system and the hardware itself).
You can take any pointer, cast it as a pointer-to-structure, and then access that memory using code like to maximize the efficiency of access for a particular architecture.
Byte Buffers and Non-Heap Memory Most Java programs spend their time working with objects on the JVM heap, using getter and setter methods to retrieve or change the data in those objects.
A few programs, however, need to do something different.
However, there are situations where it would be nice to have this ability; there is a lot of structured binary data in the the real world.
Prior to JDK 1.4, Java programmers had limited options: they could read data into a , it's important to keep track of your indices.
For example, some processors can't address individual bytes, or do so much more slowly than when addressing on a word boundary.