### Question:
ArrayListOfShorts implements RandomAccess, Cloneable, Iterable<Short> { 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(); } ArrayListOfShorts(int initialCapacity);  ArrayListOfShorts();  ArrayListOfShorts(short[] a);  ArrayListOfShorts(short first, short last); void trimToSize(); void ensureCapacity(int minCapacity); int size(); void setSize(int sz); boolean isEmpty(); boolean contains(short n); int indexOf(short n); int lastIndexOf(short n); ArrayListOfShorts clone(); short get(int index); short set(int index, short element); ArrayListOfShorts add(short e); ArrayListOfShorts add(int index, short element); short remove(int index); void clear(); short[] getArray(); Iterator<Short> iterator(); String toString(int n); @Override String toString(); void sort(); ArrayListOfShorts intersection(ArrayListOfShorts other); ArrayListOfShorts merge(ArrayListOfShorts sortedLst); ArrayListOfShorts subList(int start, int end); void addUnique(short[] 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 ArrayListOfShorts((short) 1, (short) 11).toString()); assertEquals("[1, 2, 3, 4, 5 ... (5 more) ]", new ArrayListOfShorts((short) 1, (short) 11).toString(5)); assertEquals("[1, 2, 3, 4, 5]", new ArrayListOfShorts((short) 1, (short) 6).toString()); assertEquals("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]", new ArrayListOfShorts((short) 1, (short) 12).toString(11)); assertEquals("[]", new ArrayListOfShorts().toString()); }