Having an error code and my brain is fried. Can someone please help

Here is the part of the code that the exception points to.

Huh? Where is the code?

By the way, the exception indicates that you are attempting to access the array at index 1, but the array contains only 0 or 1 index.

An empty array has size of 0. There is no valid array index to access the array.
The representation of an empty array could be written as []

An array size of 1 has only one valid index which starts from 0.
i.e. int[] array = {4};  // the array is [4]
can be accessed using array[0] and the returned value is 4
If you attempt to access array[1], it will be out of bound!