LinearCounting implements IRichCardinality { public int computeCount() { int c = 0; for (byte b : map) { c += Integer.bitCount(b & 0xFF); } return length - c; } LinearCounting(int size);  LinearCounting(byte[] map); @Override long cardinality(); @Override byte[] getBytes(); @Override boolean offerHashed(long hashedLong); @Override boolean offerHashed(int hashedInt); @Override boolean offer(Object o); @Override int sizeof(); int computeCount(); double getUtilization(); int getCount(); boolean isSaturated(); @Override IRichCardinality merge(IRichCardinality... estimators); static LinearCounting mergeEstimators(LinearCounting... estimators);  }
@Test public void testComputeCount() { LinearCounting lc = new LinearCounting(4); lc.offer(0); lc.offer(1); lc.offer(2); lc.offer(3); lc.offer(16); lc.offer(17); lc.offer(18); lc.offer(19); assertEquals(27, lc.computeCount()); }