You use i1 in your loop, but you get access to element i .
This confusion is probably caused by the use of names without descriptive variables. For example, do I see array and arraylist - those that should be the same?
So, the first problem is just clearing the code. If this is not an exact code, then show us what it is. Also note that you can make a block of code by deferring all 4 spaces. It's also a good idea to show us what a stack trace is.
Ideally, a small, complete program that we can compile that shows us that the error will create the fastest corrective answer. You can even find a problem when creating this small program.
source share