How to Implement Bubble Sort Algorithm in Swift and Java