code: public static int validArrayIndex(final int index, final int arrayLength,
              final String message) {
          if (index < 0 || index >= arrayLength) {
              throw new IndexOutOfBoundsException(message);
          }
          return index;
      }
docs: Throws an {@link IndexOutOfBoundsException} if {@code index} is negative
  or equal to or greater than {@code arrayLength}.
  
  @param index the index value to be checked
  @param arrayLength the upper bound against which {@code index} is checked
  @param message exception message
  @return the {@code index}