code: private void grow(int minCapacity) {
          // overflow-conscious code
          int oldCapacity = buf.length;
          int newCapacity = oldCapacity << 1;
          if (newCapacity - minCapacity < 0)
              newCapacity = minCapacity;
          if (newCapacity < 0) {
              if (minCapacity < 0) // overflow
                  throw new OutOfMemoryError();
              newCapacity = Integer.MAX_VALUE;
          }
          buf = copyOf(buf, newCapacity);
      }
docs: Increases the capacity to ensure that it can hold at least the
  number of elements specified by the minimum capacity argument.
  
  @param minCapacity the desired minimum capacity