catch array out of bounds exception java

Java
try {
    array[index] = someValue;
}
catch(ArrayIndexOutOfBoundsException exception) {
    handleTheExceptionSomehow(exception);
}
Source

Also in Java: