public void testBufferedLoaderReuse() throws Throwable {
int maxId = 5000;
int[] maxNumItems = { 25, 50, 20, 100, 15, 500, 10, 1000, 5, 2000, 2 };
int[][] count = new int[maxNumItems.length][maxId];
BigIntBuffer buffer = new BigIntBuffer();
BufferedLoader loader = new BufferedLoader(maxId, BigNestedIntArray.MAX_ITEMS, buffer);
BigNestedIntArray[] nestedArray = new BigNestedIntArray[maxNumItems.length];
for (int i = 0; i < maxNumItems.length; i++) {
for (int id = 0; id < maxId; id++) {
int cnt = id % (maxNumItems[i] + 1);
for (int val = 0; val < cnt; val++) {
if (loader.add(id, val)) count[i][id]++;
}
}
nestedArray[i] = new BigNestedIntArray();
nestedArray[i].load(maxId, loader);
loader.reset(maxId, BigNestedIntArray.MAX_ITEMS, buffer);
}
for (int i = 0; i < maxNumItems.length; i++) {
int[] buf = new int[1024];
for (int id = 0; id < maxId; id++) {