private static <T> boolean contains(ByteBuff bloomBuf, int bloomOffset, int bloomSize, Hash hash,
    int hashCount, HashKey<T> hashKey) {
    int hash1 = hash.hash(hashKey, 0);
    int bloomBitSize = bloomSize << 3;

    int hash2 = 0;
    int compositeHash = 0;

    if (randomGeneratorForTest == null) {
      // Production mode
      compositeHash = hash1;
      hash2 = hash.hash(hashKey, hash1);
    }

    for (int i = 0; i < hashCount; i++) {
      int hashLoc = (randomGeneratorForTest == null
        // Production mode
        ? Math.abs(compositeHash % bloomBitSize)
        // Test mode with "fake look-ups" to estimate "ideal false positive rate"
        : randomGeneratorForTest.nextInt(bloomBitSize));
      compositeHash += hash2;
      if (!checkBit(hashLoc, bloomBuf, bloomOffset)) {
        return false;
      }
    }
    return true;
  }
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