public static BloomFilterChunk createBySize(int byteSizeHint, double errorRate, int hashType,
    int foldFactor, BloomType bloomType) {
    BloomFilterChunk bbf = new BloomFilterChunk(hashType, bloomType);

    bbf.byteSize = computeFoldableByteSize(byteSizeHint * 8L, foldFactor);
    long bitSize = bbf.byteSize * 8;
    bbf.maxKeys = (int) idealMaxKeys(bitSize, errorRate);
    bbf.hashCount = optimalFunctionCount(bbf.maxKeys, bitSize);

    // Adjust max keys to bring error rate closer to what was requested,
    // because byteSize was adjusted to allow for folding, and hashCount was
    // rounded.
    bbf.maxKeys = (int) computeMaxKeys(bitSize, errorRate, bbf.hashCount);

    return bbf;
  }
Creates a Bloom filter chunk of the given size.
@param byteSizeHint the desired number of bytes for the Bloom filter bit array. Will be
                    increased so that folding is possible.
@param errorRate    target false positive rate of the Bloom filter
@param hashType     Bloom filter hash function type
@return the new Bloom filter of the desired size
hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomFilterUtil.java