code: static int computeRetainedItems(final int k, final long n) {
      final int bbCnt = computeBaseBufferItems(k, n);
      final long bitPattern = computeBitPattern(k, n);
      final int validLevels = computeValidLevels(bitPattern);
      return bbCnt + (validLevels * k);
    }
docs: Returns the number of retained valid items in the sketch given k and n.
  @param k the given configured k of the sketch
  @param n the current number of items seen by the sketch
  @return the number of retained items in the sketch given k and n.