public static int[] decode(long z) {
        int[] xy = new int[2];

        long xl = z & 0x5555555555555555L;
        long yl = z & 0xaaaaaaaaaaaaaaaaL;

        xl = ((xl & 0xccccccccccccccccL) >> 1) | (xl & 0x3333333333333333L);
        yl = ((yl & 0xccccccccccccccccL) >> 1) | (yl & 0x3333333333333333L);

        xl = ((xl & 0xf0f0f0f0f0f0f0f0L) >> 2) | (xl & 0x0f0f0f0f0f0f0f0fL);
        yl = ((yl & 0xf0f0f0f0f0f0f0f0L) >> 2) | (yl & 0x0f0f0f0f0f0f0f0fL);

        xl = ((xl & 0xff00ff00ff00ff00L) >> 4) | (xl & 0x00ff00ff00ff00ffL);
        yl = ((yl & 0xff00ff00ff00ff00L) >> 4) | (yl & 0x00ff00ff00ff00ffL);

        xl = ((xl & 0xffff0000ffff0000L) >> 8) | (xl & 0x0000ffff0000ffffL);
        yl = ((yl & 0xffff0000ffff0000L) >> 8) | (yl & 0x0000ffff0000ffffL);

        xl = ((xl & 0xffffffff00000000L) >> 16) | (xl & 0x00000000ffffffffL);
        yl = ((yl & 0xffffffff00000000L) >> 16) | (yl & 0x00000000ffffffffL);

        xy[0] = (int)xl;
        xy[1] = (int)(yl >> 1);
        return xy;
     }
Decode a z-value into the original two integers.  Returns an
array of two Integers, x and y in indices 0 and 1 respectively.

@param z  The bit-interleaved long containing x and y.
@return   Array of two Integers, x and y.
vespajlib/src/main/java/com/yahoo/geo/ZCurve.java