X440: Sorting - Create Bubble Sort

Write a function in Java that takes in the int[] array, sorts it using bubble sort, then returns back the sorted array.

Examples:

bubbleSort({4,7,1}) -> {1,4,7}
bubbleSort({80,6,6,8,2}) -> {2,6,6,8,80}

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.