code: @Override
      @SuppressWarnings("unchecked")
      protected void ensureCapacity(int capacity) {
          checkCapacity(capacity);
          K[] newArray = (K[]) new Object[capacity];
          System.arraycopy(array, 0, newArray, 0, size);
          array = newArray;
          BitSet newBitSet = new BitSet(capacity);
          newBitSet.or(reverse);
          reverse = newBitSet;
      }
docs: Ensure that the array representation has the necessary capacity.
  
  @param capacity
  the requested capacity