private void checkIndex(int index, int first, int last) { if (index > last || index < first) { throw new ArrayIndexOutOfBoundsException(); } }