Halo,
The java.lang.ArrayIndexOutOfBoundsException means that your are trying to access an array object with an index larger than the current data inside the array.
Array in
Java is zero indexed, which means the array index start from zero. So if you have five items in it (array length = 5) it means the index if from 0 to 4. In your code you have five items in the array, this mean the maximum array index is 4.
To fix the error in your code you have to change the for loop condition check in insertionSort() method.
Regards,
Wayan