private void rangeCheck(int index) {
    int currentSize = size(); // byte to int
    if (index >= currentSize) {
      throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + currentSize);
    }
  }
Checks if the given index is in range. If not, throws an appropriate runtime exception. This
method does *not* check if the index is negative: It is always used immediately prior to an
array access, which throws an ArrayIndexOutOfBoundsException if index is negative.
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexElemArray.java