If you just list the function as being able to throw an exception but never actually throw the exception in the function, no exception is ever generated.
If you throw the exception but don't list the function as being able to throw an exception, you may get a compiler error or warning about an uncaught exception.
You need to list your function as throwing an ArrayIndexOutOfBoundsException and throw the exception somewhere in your function.
For example:
public ... myArrayFunction(...) throws ArrayIndexOutOfBoundsException {
.... // handle the array
if (some condition) {
throw new ArrayIndexOutOfBoundsException("Array Index Out of Bounds");
}
}