### Question:
IntIndexManager implements Serializable { public IntIndexManager() { nextIndex = 0; freeList = new ArrayList<Integer>(); } IntIndexManager(); int allocate(); void deallocate(int index); void clear();  }### Answer:
@Test public void testIntIndexManager() { IntIndexManager imgr = new IntIndexManager(); System.out.println("test basic allocation"); for(int i=0;i<10;i++) { assertEquals(i, imgr.allocate()); } System.out.println("test deallocation"); for(int i=5;i<8;i++) { imgr.deallocate(i); } for(int i = 7;i>=5;i--) { assertEquals(i, imgr.allocate()); } assertEquals(10, imgr.allocate()); System.out.println("test clear all"); imgr.clear(); for(int i=0;i<10;i++) { assertEquals(i, imgr.allocate()); } }