Morton Pack/Unpack Library
Basics
Check wikipedia for details.
Example
import com.gojuno.morton.Morton64;
Morton64 m = new Morton64(2, 32); // 2 dimenstions 32 bits each
long code = m.pack(13, 42); // pack two values
long[] values = m.unpack(code); // should get back 13 and 42