code: private int calcSize()
    {
      int retVal = 0;
      for (int i = 0; i <= lastWordIndex; i++) {
        int w = words.get(i);
        if (ConciseSetUtils.isLiteral(w)) {
          retVal += ConciseSetUtils.getLiteralBitCount(w);
        } else {
          if (ConciseSetUtils.isZeroSequence(w)) {
            if (!ConciseSetUtils.isSequenceWithNoBits(w)) {
              retVal++;
            }
          } else {
            retVal += ConciseSetUtils.maxLiteralLengthMultiplication(ConciseSetUtils.getSequenceCount(w) + 1);
            if (!ConciseSetUtils.isSequenceWithNoBits(w)) {
              retVal--;
            }
          }
        }
      }
  
      return retVal;
    }
docs: Based on the ConciseSet implementation by Alessandro Colantonio