@Test public void testBloomNumBits() { assertEquals(0, Bloom1Filter.optimalNumOfBits(0, 0)); assertEquals(1549, Bloom1Filter.optimalNumOfBits(1, 0)); assertEquals(0, Bloom1Filter.optimalNumOfBits(0, 1)); assertEquals(0, Bloom1Filter.optimalNumOfBits(1, 1)); assertEquals(7, Bloom1Filter.optimalNumOfBits(1, 0.03)); assertEquals(72, Bloom1Filter.optimalNumOfBits(10, 0.03)); assertEquals(729, Bloom1Filter.optimalNumOfBits(100, 0.03)); assertEquals(7298, Bloom1Filter.optimalNumOfBits(1000, 0.03)); assertEquals(72984, Bloom1Filter.optimalNumOfBits(10000, 0.03)); assertEquals(729844, Bloom1Filter.optimalNumOfBits(100000, 0.03)); assertEquals(7298440, Bloom1Filter.optimalNumOfBits(1000000, 0.03)); assertEquals(6235224, Bloom1Filter.optimalNumOfBits(1000000, 0.05)); }
static long optimalNumOfBits(long n, double p) { if (p == 0) { p = Double.MIN_VALUE; } return (long) (-n * Math.log(p) / (Math.log(2) * Math.log(2))); }
Bloom1Filter { static long optimalNumOfBits(long n, double p) { if (p == 0) { p = Double.MIN_VALUE; } return (long) (-n * Math.log(p) / (Math.log(2) * Math.log(2))); } }
Bloom1Filter { static long optimalNumOfBits(long n, double p) { if (p == 0) { p = Double.MIN_VALUE; } return (long) (-n * Math.log(p) / (Math.log(2) * Math.log(2))); } Bloom1Filter(long maxNumEntries);  Bloom1Filter(long maxNumEntries, double fpp);  Bloom1Filter(List<Long> serializedBloom); }
Bloom1Filter { static long optimalNumOfBits(long n, double p) { if (p == 0) { p = Double.MIN_VALUE; } return (long) (-n * Math.log(p) / (Math.log(2) * Math.log(2))); } Bloom1Filter(long maxNumEntries);  Bloom1Filter(long maxNumEntries, double fpp);  Bloom1Filter(List<Long> serializedBloom); long sizeInBytes(); void add(byte[] val); void addBytes(byte[] val); void addString(String val); void addByte(byte val); void addInt(int val); void addLong(long val); void addFloat(float val); void addDouble(double val); boolean test(byte[] val); boolean testBytes(byte[] val); boolean testString(String val); boolean testByte(byte val); boolean testInt(int val); boolean testLong(long val); boolean testFloat(float val); boolean testDouble(double val); long getBitSize(); int getNumHashFunctions(); double getFalsePositivePercent(); long getExpectedNumEntries(); List<Long> serialize(); boolean isCompatible(Bloom1Filter that); void merge(Bloom1Filter that); }
Bloom1Filter { static long optimalNumOfBits(long n, double p) { if (p == 0) { p = Double.MIN_VALUE; } return (long) (-n * Math.log(p) / (Math.log(2) * Math.log(2))); } Bloom1Filter(long maxNumEntries);  Bloom1Filter(long maxNumEntries, double fpp);  Bloom1Filter(List<Long> serializedBloom); long sizeInBytes(); void add(byte[] val); void addBytes(byte[] val); void addString(String val); void addByte(byte val); void addInt(int val); void addLong(long val); void addFloat(float val); void addDouble(double val); boolean test(byte[] val); boolean testBytes(byte[] val); boolean testString(String val); boolean testByte(byte val); boolean testInt(int val); boolean testLong(long val); boolean testFloat(float val); boolean testDouble(double val); long getBitSize(); int getNumHashFunctions(); double getFalsePositivePercent(); long getExpectedNumEntries(); List<Long> serialize(); boolean isCompatible(Bloom1Filter that); void merge(Bloom1Filter that);  }