public static int optimalFunctionCount(int maxKeys, long bitSize) {
    long i = bitSize / maxKeys;
    double result = Math.ceil(Math.log(2) * i);
    if (result > Integer.MAX_VALUE) {
      throw new IllegalArgumentException("result too large for integer value.");
    }
    return (int) result;
  }
Increases the given byte size of a Bloom filter until it can be folded by the given factor.
@return Foldable byte size
hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomFilterUtil.java