code: public static <T extends CharSequence> T validIndex(final T chars, final int index, final String message, final Object... values) {
          Validate.notNull(chars);
          if (index < 0 || index >= chars.length()) {
              throw new IndexOutOfBoundsException(StringUtils.simpleFormat(message, values));
          }
          return chars;
      }
docs: <p>Validates that the index is within the bounds of the argument
  character sequence; otherwise throwing an exception with the
  specified message.</p>
  
  <pre>Validate.validIndex(myStr, 2, "The string index is invalid: ");</pre>
  
  <p>If the character sequence is {@code null}, then the message
  of the exception is &quot;The validated object is null&quot;.</p>
  
  @param <T> the character sequence type
  @param chars  the character sequence to check, validated not null by this method
  @param index  the index to check
  @param message  the {@link String#format(String, Object...)} exception message if invalid, not null
  @param values  the optional values for the formatted exception message, null array not recommended
  @return the validated character sequence (never {@code null} for method chaining)
  @throws NullPointerException if the character sequence is {@code null}
  @throws IndexOutOfBoundsException if the index is invalid
  @see #validIndex(CharSequence, int)
  
  @since 3.0