### Question:
IntVector { public void trimToSize() { data = Arrays.copyOf(data, size); } IntVector();  IntVector(int initialCapacity);  IntVector(int[] values); void add(int i); void addAll(int[] arr); void addAll(IntVector vec); int get(int index); void set(int index, int value); void safeSet(int index, int value); int size(); int capacity(); void sort(); int[] copyOf(); void shuffle(Random random); boolean contains(int i); void shuffle(); void trimToSize(); boolean isempty(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testTrimToSize() { IntVector darray = new IntVector(); for (int i = 0; i < 10000; i++) { darray.add(i); } Assert.assertEquals(10000, darray.size()); Assert.assertNotEquals(darray.size(), darray.capacity()); darray.trimToSize(); Assert.assertEquals(10000, darray.size()); Assert.assertEquals(10000, darray.copyOf().length); Assert.assertEquals(darray.size(), darray.capacity()); }