public static <T> T[] validIndex(final T[] array, final int index) {
        return validIndex(array, index, DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE, Integer.valueOf(index));
    }
<p>Validates that the index is within the bounds of the argument
array; otherwise throwing an exception.</p>

<pre>Validate.validIndex(myArray, 2);</pre>

<p>If the array is {@code null}, then the message of the exception
is &quot;The validated object is null&quot;.</p>

<p>If the index is invalid, then the message of the exception is
&quot;The validated array index is invalid: &quot; followed by the
index.</p>

@param <T> the array type
@param array  the array to check, validated not null by this method
@param index  the index to check
@return the validated array (never {@code null} for method chaining)
@throws NullPointerException if the array is {@code null}
@throws IndexOutOfBoundsException if the index is invalid
@see #validIndex(Object[], int, String, Object...)

@since 3.0
replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/Validate.java