Minecraft wiki entry for History, associated text: Let X and Z be the values contained within the LevelDB key.
Let C [] be a three dimensional array of the chunk of 32,768 blocks contained within the LevelDB entry. The first two indices i and j range from 0 to 15, and the third index y ranges from 0 to 127.
Let W [] be a three dimensional array of the blocks contained within the entire world.
For old style worlds, the first two indices x and z both range from 0 to 255. For infinite worlds, the first two indices x and z both range over the values of a four byte integer and may be negative as well as positive.
The third index y ranges from 0 to 127 for both old style and infinite worlds.