@Test public void depairTest() { TestHelper.load(); int x = 10; int seed = 10; long pair = CantorPairing.pair(x, seed); long[] depair = CantorPairing.depair(pair); assertEquals(x, depair[0]); assertEquals(seed, depair[1]); }
public static long[] depair(long z) { long t = (int) Math.floor((Math.sqrt(8 * z + 1) - 1) / 2); long x = t * (t + 3) / 2 - z; long y = z - t * (t + 1) / 2; return new long[]{x, y}; }
CantorPairing { public static long[] depair(long z) { long t = (int) Math.floor((Math.sqrt(8 * z + 1) - 1) / 2); long x = t * (t + 3) / 2 - z; long y = z - t * (t + 1) / 2; return new long[]{x, y}; } }
CantorPairing { public static long[] depair(long z) { long t = (int) Math.floor((Math.sqrt(8 * z + 1) - 1) / 2); long x = t * (t + 3) / 2 - z; long y = z - t * (t + 1) / 2; return new long[]{x, y}; } private  CantorPairing(); }
CantorPairing { public static long[] depair(long z) { long t = (int) Math.floor((Math.sqrt(8 * z + 1) - 1) / 2); long x = t * (t + 3) / 2 - z; long y = z - t * (t + 1) / 2; return new long[]{x, y}; } private  CantorPairing(); static long pair(final int k1, final long k2); static long[] depair(long z); }
CantorPairing { public static long[] depair(long z) { long t = (int) Math.floor((Math.sqrt(8 * z + 1) - 1) / 2); long x = t * (t + 3) / 2 - z; long y = z - t * (t + 1) / 2; return new long[]{x, y}; } private  CantorPairing(); static long pair(final int k1, final long k2); static long[] depair(long z);  }