assertEquals(10, m.interleave(0, 3));
assertEquals(10, m.interleave(new int[] { 0, 3 }));
long v = Integer.MAX_VALUE | ((long) Integer.MAX_VALUE << 31L);
assertEquals(v, m.interleave(Integer.MAX_VALUE, Integer.MAX_VALUE));
assertEquals(v, m.interleave(new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE }));
Random random = new Random(1);
for (int i = 0; i < 1000; i++) {
int x = random.nextInt(Integer.MAX_VALUE), y = random.nextInt(Integer.MAX_VALUE);
v = m.interleave(new int[] {x, y});
long v2 = m.interleave(x, y);
assertEquals(v, v2);
int x1 = m.deinterleave(2, v, 0);
int y1 = m.deinterleave(2, v, 1);
assertEquals(x, x1);
assertEquals(y, y1);
}
for (int i = 0; i < 1000; i++) {
int x = random.nextInt(1000), y = random.nextInt(1000), z = random.nextInt(1000);
MultiDimension tool = MultiDimension.getInstance();
long xyz = tool.interleave(new int[] { x, y, z });
assertEquals(x, tool.deinterleave(3, xyz, 0));
assertEquals(y, tool.deinterleave(3, xyz, 1));
assertEquals(z, tool.deinterleave(3, xyz, 2));