Murmur1HashPartitioner implements HashPartitioner { @Override public Long hash(String key) { if (key == null) { return 0L; } ByteBuffer bb = ByteBuffer.wrap(key.getBytes(charset)); byte[] b = bb.array(); return UnsignedIntsUtils.toLong(Murmur1Hash.hash(b, b.length)); }  @Override Long hash(String key); @Override Long hash(byte[] key); @Override Long hash(long key); @Override Long hash(int key); @Override HostToken getToken(Long keyHash);  }
@Test public void test1MKeys() throws Exception { Murmur1HashPartitioner hash = new Murmur1HashPartitioner(); List<String> testTokens = readInTestTokens(); for (int i = 0; i < 1000000; i++) { long lHash = hash.hash("" + i); long expected = Long.parseLong(testTokens.get(i)); Assert.assertEquals("Failed for i: " + i, expected, lHash); } }