BloomFilterAlt implements IFilter<E>, Serializable { public static int[] createHashes(byte[] data, int hashes) { int[] result = new int[hashes]; int k = 0; byte salt = 0; while (k < hashes) { byte[] digest; synchronized (digestFunction) { digestFunction.update(salt); salt++; digest = digestFunction.digest(data); } for (int i = 0; i < digest.length/4 && k < hashes; i++) { int h = 0; for (int j = (i*4); j < (i*4)+4; j++) { h <<= 8; h |= ((int) digest[j]) & 0xFF; } result[k] = h; k++; } } return result; } BloomFilterAlt(double c, int n, int k);  BloomFilterAlt(int bitSetSize, int expectedNumberOElements);  BloomFilterAlt(double falsePositiveProbability, int expectedNumberOfElements);  BloomFilterAlt(int bitSetSize, int expectedNumberOfFilterElements, int actualNumberOfFilterElements, BitSet filterData); static int createHash(String val, Charset charset); static int createHash(String val); static int createHash(byte[] data); static int[] createHashes(byte[] data, int hashes); @Override boolean equals(Object obj); @Override int hashCode(); double expectedFalsePositiveProbability(); double getFalsePositiveProbability(double numberOfElements); double getFalsePositiveProbability(); int getK(); void clear(); void add(E element); void add(byte[] bytes); double getPercentNonZero(); int getNumNonZero(); void addAll(Collection<? extends E> c); boolean membershipTest(E element); boolean contains(E element); boolean contains(byte[] bytes); boolean containsAll(Collection<? extends E> c); boolean getBit(int bit); void setBit(int bit, boolean value); BitSet getBitSet(); int size(); int count(); int getExpectedNumberOfElements(); double getExpectedBitsPerElement(); double getBitsPerElement();  }
@Test public void testCreateHashes_byteArr() throws UnsupportedEncodingException { System.out.println("createHashes"); String val = UUID.randomUUID().toString(); byte[] data = val.getBytes("UTF-8"); int[] result1 = BloomFilterAlt.createHashes(data, 10); int[] result2 = BloomFilterAlt.createHashes(data, 10); assertEquals(result1.length, 10); assertEquals(result2.length, 10); assertArrayEquals(result1, result2); int[] result3 = BloomFilterAlt.createHashes(data, 5); assertEquals(result3.length, 5); for (int i = 0; i < result3.length; i++) assertEquals(result3[i], result1[i]); }