IntegerStack { private void grow() { Integer[] temp = new Integer[data.length + CHUNK_SIZE]; System.arraycopy(data, 0, temp, 0, data.length); data = temp; }  synchronized Integer push(Integer x); synchronized Integer pop(); synchronized Integer peek(); synchronized void clear(); int size(); static final int CHUNK_SIZE; static final int CLEAR_SIZE; }
@Test public void grow() { for (int i = 0; i < 5 * IntegerStack.CHUNK_SIZE; i++) { stk.push(i); } for (int i = 5 * IntegerStack.CHUNK_SIZE - 1; i >= 0; i--) { assertEquals(i, stk.pop().intValue()); } }