@Test
    public void testEncoding() {
        int x = 0;
        int y = 0;
        long z = ZCurve.encode(x, y);
        assertEquals(0, z);

        x = Integer.MAX_VALUE;
        y = Integer.MAX_VALUE;
        z = ZCurve.encode(x, y);
        assertEquals(0x3fffffffffffffffL, z);

        x = Integer.MIN_VALUE;
        y = Integer.MIN_VALUE;
        z = ZCurve.encode(x, y);
        assertEquals(0xc000000000000000L, z);

        x = Integer.MIN_VALUE;
        y = Integer.MAX_VALUE;
        z = ZCurve.encode(x, y);
        assertEquals(0x6aaaaaaaaaaaaaaaL, z);

        x = -1;
        y = -1;
        z = ZCurve.encode(x, y);
        assertEquals(0xffffffffffffffffL, z);

        x = Integer.MAX_VALUE / 2;
        y = Integer.MIN_VALUE / 2;
        z = ZCurve.encode(x, y);
        assertEquals(0xa555555555555555L, z);
    }
Verify that encoded values return the expected bit pattern
vespajlib/src/test/java/com/yahoo/geo/ZCurveTestCase.java