/**
* Constructs an empty Bloom filter. The total length of the Bloom filter will be c*n.
* @param c is the number of bits used per element.
* @param n is the expected number of elements the filter will contain.
* @param k is the number of hash functions used.
*/
public BloomFilter(double c,int n,int k){
this.expectedNumberOfFilterElements=n;
if (k == 0) {
k=1;
}
this.k=k;
this.bitsPerElement=c;
this.bitSetSize=(int)Math.ceil(c * n);
numberOfAddedElements=0;
this.bitset=new BitSet(bitSetSize);
}

Example 28

From project eventtracker, under directory /scribe/src/test/java/com/ning/metrics/eventtracker/.