private void ensureCapacity(int minCapacity) {
    if (minCapacity > 255) {
      throw new IllegalStateException("attempt to increase the size beyond 255 elements");
    }
    int oldCapacity = elementData.length;
    if (minCapacity > oldCapacity) {
      int newCapacity = oldCapacity + 5;
      if (newCapacity < minCapacity || 255 < newCapacity) {
        newCapacity = minCapacity;
      }
      // minCapacity is usually close to size, so this is a win:
      Object[] newElementData = new Object[newCapacity];
      System.arraycopy(elementData, 0, newElementData, 0, elementData.length);
      elementData = newElementData;
    }
  }
Increases the capacity of this <tt>ArrayList</tt> instance, if necessary, to ensure that it can
hold at least the number of elements specified by the minimum capacity argument.

@param minCapacity the desired minimum capacity
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexElemArray.java