BloomFilter implements Serializable { public synchronized boolean contains(byte[] bytes) { int[] hashes = createHashes(bytes, k); for (int hash : hashes) { if (!bitset.get(Math.abs(hash % bitSetSize))) { return false; } } return true; } BloomFilter(double c, int n, int k);  BloomFilter(int bitSetSize, int expectedNumberOElements);  BloomFilter(double falsePositiveProbability, int expectedNumberOfElements);  BloomFilter(int bitSetSize, int expectedNumberOfFilterElements, int actualNumberOfFilterElements, BitSet filterData); @Override boolean equals(Object obj); @Override int hashCode(); double expectedFalsePositiveProbability(); double getFalsePositiveProbability(double numberOfElements); double getFalsePositiveProbability(); int getK(); synchronized void clear(); synchronized void add(byte[] bytes); synchronized boolean contains(byte[] bytes); synchronized boolean getBit(int bit); synchronized void setBit(int bit, boolean value); synchronized BitSet getBitSet(); synchronized int size(); synchronized int count(); int getExpectedNumberOfElements(); double getExpectedBitsPerElement(); double getBitsPerElement();  }
@Test public void testContains() throws Exception { System.out.println("contains"); BloomFilter instance = new BloomFilter(10000, 10); for (int i = 0; i < 10; i++) { byte[] bytes = getBytesFromUUID(UUID.randomUUID()); instance.add(bytes); assert(instance.contains(bytes)); } assertFalse(instance.contains(UUID.randomUUID().toString().getBytes("UTF-8"))); }