@Test public void pairTest() { TestHelper.load(); long val; val = CantorPairing.pair(0, 0); Assert.assertEquals(val, 0); val = CantorPairing.pair(0, 10); Assert.assertEquals(val, 65); val = CantorPairing.pair(10, 0); Assert.assertEquals(val, 55); val = CantorPairing.pair(10, 10); Assert.assertEquals(val, 220); }
public static long pair(final int k1, final long k2) { return (k1 + k2) * (k1 + k2 + 1) / 2 + k2; }
CantorPairing { public static long pair(final int k1, final long k2) { return (k1 + k2) * (k1 + k2 + 1) / 2 + k2; } }
CantorPairing { public static long pair(final int k1, final long k2) { return (k1 + k2) * (k1 + k2 + 1) / 2 + k2; } private  CantorPairing(); }
CantorPairing { public static long pair(final int k1, final long k2) { return (k1 + k2) * (k1 + k2 + 1) / 2 + k2; } private  CantorPairing(); static long pair(final int k1, final long k2); static long[] depair(long z); }
CantorPairing { public static long pair(final int k1, final long k2) { return (k1 + k2) * (k1 + k2 + 1) / 2 + k2; } private  CantorPairing(); static long pair(final int k1, final long k2); static long[] depair(long z);  }