code: @Override
    public void complement()
    {
      modCount++;
  
      if (isEmpty()) {
        return;
      }
  
      if (last == ConciseSetUtils.MIN_ALLOWED_SET_BIT) {
        clear();
        return;
      }
  
      // update size
      if (size >= 0) {
        size = last - size + 1;
      }
  
      // complement each word
      for (int i = 0; i <= lastWordIndex; i++) {
        int w = words[i];
        if (isLiteral(w))
        // negate the bits and set the most significant bit to 1
        {
          words[i] = ConciseSetUtils.ALL_ZEROS_LITERAL | ~w;
        } else
        // switch the sequence type
        {
          words[i] ^= ConciseSetUtils.SEQUENCE_BIT;
        }
      }
  
      // do not complement after the last element
      if (isLiteral(words[lastWordIndex])) {
        clearBitsAfterInLastWord(maxLiteralLengthModulus(last));
      }
  
      // remove trailing zeros
      trimZeros();
      if (isEmpty()) {
        return;
      }
  
      // calculate the maximal element
      last = 0;
      int w = 0;
      for (int i = 0; i <= lastWordIndex; i++) {
        w = words[i];
        if (isLiteral(w)) {
          last += ConciseSetUtils.MAX_LITERAL_LENGTH;
        } else {
          last += maxLiteralLengthMultiplication(getSequenceCount(w) + 1);
        }
      }
  
      // manage the last word (that must be a literal or a sequence of 1's)
      if (isLiteral(w)) {
        last -= Integer.numberOfLeadingZeros(getLiteralBits(w));
      } else {
        last--;
      }
    }
docs: {@inheritDoc}