### Question:
ArrayListOfInts implements RandomAccess, Cloneable, Iterable<Integer> { public int remove(int index) { if (index >= size) { throw new ArrayIndexOutOfBoundsException(); } int oldValue = array[index]; int numMoved = size - index - 1; if (numMoved > 0) { System.arraycopy(array, index + 1, array, index, numMoved); } size--; return oldValue; } ArrayListOfInts(int initialCapacity);  ArrayListOfInts();  ArrayListOfInts(int[] a);  ArrayListOfInts(int first, int last); void trimToSize(); void ensureCapacity(int minCapacity); int size(); void setSize(int sz); boolean isEmpty(); boolean contains(int n); int indexOf(int n); int lastIndexOf(int n); ArrayListOfInts clone(); int get(int index); int set(int index, int element); ArrayListOfInts add(int e); ArrayListOfInts add(int index, int element); int remove(int index); void clear(); int[] getArray(); Iterator<Integer> iterator(); String toString(int n); @Override String toString(); void sort(); ArrayListOfInts intersection(ArrayListOfInts other); ArrayListOfInts merge(ArrayListOfInts sortedLst); ArrayListOfInts mergeNoDuplicates(ArrayListOfInts sortedLst); ArrayListOfInts subList(int start, int end); void addUnique(int[] arr); void shiftLastNToTop(int n); @Override boolean equals(Object obj);  }### Answer:
@Test public void testArrayConstructor() { int[] arr = new int[] { 1, 2, 3, 4, 5 }; assertEquals(5, arr.length); ArrayListOfInts list = new ArrayListOfInts(arr); list.remove(2); assertEquals(1, arr[0]); assertEquals(2, arr[1]); assertEquals(3, arr[2]); assertEquals(4, arr[3]); assertEquals(5, arr[4]); }
@Test public void testRemove() { ArrayListOfInts list = new ArrayListOfInts(); for (int i = 0; i < 10; i++) { list.add(i); } list.remove(list.indexOf(5)); assertEquals(9, list.size()); assertEquals(0, list.get(0)); assertEquals(1, list.get(1)); assertEquals(2, list.get(2)); assertEquals(3, list.get(3)); assertEquals(4, list.get(4)); assertEquals(6, list.get(5)); assertEquals(7, list.get(6)); assertEquals(8, list.get(7)); assertEquals(9, list.get(8)); list.remove(list.indexOf(9)); assertEquals(8, list.size()); assertEquals(0, list.get(0)); assertEquals(1, list.get(1)); assertEquals(2, list.get(2)); assertEquals(3, list.get(3)); assertEquals(4, list.get(4)); assertEquals(6, list.get(5)); assertEquals(7, list.get(6)); assertEquals(8, list.get(7)); }