private void grow(int minCapacity) {
    int oldCapacity = elementData.length;
    int newCapacity = oldCapacity + (oldCapacity >> 1);
    if (newCapacity - minCapacity < 0) {
      newCapacity = minCapacity;
    }
    elementData = Arrays.copyOf(elementData, newCapacity);
  }
@Test
  public void grow() {
    // Default capacity is 10
    IntArrayList list = new IntArrayList();
    for (int i = 1; i <= 11; i++) {
      list.add(i);
    }
    assertThat(list.trimAndGet()).hasSize(11);
  }