1 public static void bubbleSort(int[] arr) { 2 for (int i = 0; i < arr.length - 1; i++) { 3 for (int j = 0; j < arr.length - i - 1; j++) { 4 if (arr[j] > arr[j + 1]) { 5 int temp = arr[j]; 6 arr[j] = arr[j + 1]; 7 arr[j + 1] = temp; 8 } 9 } 10 } 11 }