docs: @Override
    public RoaringBitmap limit(int maxcardinality) {
      RoaringBitmap answer = new RoaringBitmap();
      int currentcardinality = 0;
      for (int i = 0; (currentcardinality < maxcardinality)
          && (i < this.highLowContainer.size()); i++) {
        Container c = this.highLowContainer.getContainerAtIndex(i);
        if (c.getCardinality() + currentcardinality <= maxcardinality) {
          answer.highLowContainer.appendCopy(this.highLowContainer, i);
          currentcardinality += c.getCardinality();
        } else {
          int leftover = maxcardinality - currentcardinality;
          Container limited = c.limit(leftover);
          answer.highLowContainer.append(this.highLowContainer.getKeyAtIndex(i), limited);
          break;
        }
      }
      return answer;
    }