public IntArray(int capacity) {
    elementData = new int[capacity];
  }
@Test
  public void testIntArray() {
    IntArray array = new IntArray(10);
    for (int i = 0; i < 10; i++) {
      array.add(i * 2);
    }
    assertEquals(array.elementData, IntStream.range(0, 10).map(i -> i * 2).toArray());
    int[] elementData = array.elementData;
    array.add(1);
    assertNotSame(elementData, array.elementData);
  }