MCPcopy Create free account
hub / github.com/CDSecLab/MJXT / construct

Method construct

src/main/java/utils/Bloom.java:9–17  ·  view source on GitHub ↗
(long[] keys, double bitsPerKey)

Source from the content-addressed store, hash-verified

7public class Bloom {
8
9 public static Bloom construct(long[] keys, double bitsPerKey) {
10 long n = keys.length;
11 int k = getBestK(bitsPerKey);
12 Bloom f = new Bloom((int) n, bitsPerKey, k);
13 for(long x : keys) {
14 f.add(x);
15 }
16 return f;
17 }
18
19 private static int getBestK(double bitsPerKey) {
20 return Math.max(1, (int) Math.round(bitsPerKey * Math.log(2)));

Callers 10

constructMethod · 0.95
constructMethod · 0.95
constructMethod · 0.95
mainMethod · 0.45
mainMethod · 0.45
mainMethod · 0.45
mainMethod · 0.45
mainMethod · 0.45
mainMethod · 0.45
mainMethod · 0.45

Calls 2

getBestKMethod · 0.95
addMethod · 0.95

Tested by 7

mainMethod · 0.36
mainMethod · 0.36
mainMethod · 0.36
mainMethod · 0.36
mainMethod · 0.36
mainMethod · 0.36
mainMethod · 0.36