Using ArrayList<int>

for(int i = 0; i < list.size(); i++) {
   list.remove(i)
}

would be less confusing in this code