if ((startingOffset + len) > size) { throw (new IndexOutOfBoundsException()); }
public boolean load(int[] output){    if (size < incSize) {        return false;    }    int startingOffset = size - incSize;    int len = incSize;    if ((startingOffset + len) > size) {        throw (new IndexOutOfBoundsException());    }    //int[] result = new int[len]; // allocate result array    //if (pageSize != 1) {    //int first_index = (int) (startingOffset / pageSize);    //int last_index = (int) ((startingOffset + len) / pageSize);    //if ((startingOffset + len) % pageSize == 0) {    int first_index = (startingOffset >> n);    int last_index = ((startingOffset + len) >>n);    if (((startingOffset + len)& r)== 0) {        last_index--;    }    if (first_index == last_index) {        // to see if there is a need to go across buffer boundry        System.arraycopy(            (int[]) (bufferArrayList.get(first_index)),			//startingOffset % pageSize,            startingOffset & r,            output,            0,            len);    } else {        int int_array_offset = 0;        for (int i = first_index; i <= last_index; i++) {            int[] currentChunk = (int[]) bufferArrayList.get(i);            if (i == first_index) // first section                {                System.arraycopy(                    currentChunk,                    //startingOffset % pageSize                    startingOffset & r,                    output,                    0,                  //  pageSize - (startingOffset % pageSize));                    pageSize - (startingOffset & r));                //int_array_offset += pageSize - (startingOffset) % pageSize;                int_array_offset += pageSize - (startingOffset &r);            } else if (i == last_index) // last sections                {                System.arraycopy(                    currentChunk,                    0,                    output,                    int_array_offset,                    len - int_array_offset);            } else {                System.arraycopy(currentChunk, 0, output, int_array_offset, pageSize);                int_array_offset += pageSize;            }        }    }    size -= incSize;    return true;}