!7 static int n = 100000; p { for (int listSize = 90; listSize <= 100; listSize++) { O[] array = new O[n]; long mem1 = usedMemoryAfterGC(); for i over array: array[i] = rep(null, listSize); long mem2 = usedMemoryAfterGC(); double objSize = (mem2-mem1)/(double) l(array); int rounded = iround(objSize); long f = guessArrayListSize(listSize); bool ok = rounded == f; print((ok ? "OK " : "") + "ArrayList size=" + listSize + ". Approximate object size: " + objSize + " => " + rounded + " bytes. Formula: " + f); } }