### Question:
ArrayListOfInts implements RandomAccess, Cloneable, Iterable<Integer> { public String toString(int n) { StringBuilder s = new StringBuilder(); s.append("["); int sz = size() > n ? n : size; for (int i = 0; i < sz; i++) { s.append(get(i)); if (i < sz - 1) { s.append(", "); } } s.append(size() > n ? String.format(" ... (%d more) ]", size() - n) : "]"); return s.toString(); } 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 testToString1() { assertEquals("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", new ArrayListOfInts(1, 11).toString()); assertEquals("[1, 2, 3, 4, 5 ... (5 more) ]", new ArrayListOfInts(1, 11).toString(5)); assertEquals("[1, 2, 3, 4, 5]", new ArrayListOfInts(1, 6).toString()); assertEquals("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]", new ArrayListOfInts(1, 12).toString(11)); assertEquals("[]", new ArrayListOfInts().toString()); }