static int computeRetainedItems(int k,long n){
  int bbCnt=computeBaseBufferItems(k,n);
  long bitPattern=computeBitPattern(k,n);
  int validLevels=Long.bitCount(bitPattern);
  return bbCnt + validLevels * k;
}

static int computeRetainedItems ( int k , long n ) { int bbCnt = computeBaseBufferItems ( k , n ) ; long bitPattern = computeBitPattern ( k , n ) ; int validLevels = Long . bitCount ( bitPattern ) ; return bbCnt + validLevels * k ; }
returns the number of retained items in the sketch given k and n .
