Java tutorial
//package com.java2s; public class Main { /** * Calculate the optimal number of hash functions for the bloom filter using * bloom filter size and no of elements inserted * * @param bloomFilterSize * Bloom Filter vector size * @param noOfElements * Expected number of elements inserted to the filter * @return Optimal number of hash functions */ public static int optimalNoOfHash(int bloomFilterSize, long noOfElements) { return (int) Math.round(bloomFilterSize / noOfElements * Math.log(2)); } }