[Solved] Why am I getting an IndexOutofBoundsException?


An array out of bounds exception is thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array.

This is coming from if (generated.get(round) == 1) because previously you call generated.clear(); which removes all elements of your arraylist. This means you are trying to access an index in your array which does not exist.

solved Why am I getting an IndexOutofBoundsException?