The length of the array should change when you remove elements. The arrayLen
variable stores the length of the array, but doesn’t change when the array’s length shrinks. To change it, you should be able to just replace arrayLen
with arrayList.size()
, which will change when your remove elements
0
solved Arraylist java.lang.IndexOutOfBoundsException: Index 3 out of bounds for length 3 Error