Is there any reason you want to use bubble sort? I can understand if this is a homework assignment and the teacher has specified that you do so. However, if not, you should use Collections.sort() on the original ArrayList instead. In fact, why are you converting the ArrayList into an array? Also, if you want the list sorted, there are other collections that are better to use. TreeSet will put the items in a sorted order as you add them. You can also use an Iterator to iterate over the set (or even the original ArrayList), rather than converting it into an array.