(int arr[])
| 35 | } |
| 36 | |
| 37 | public static void bubbleSortDescending(int arr[]) { |
| 38 | for(int turn=0; turn<arr.length-1; turn++) { |
| 39 | for(int j=0; j<arr.length-1-turn; j++) { |
| 40 | if(arr[j] < arr[j+1]) { |
| 41 | //swap |
| 42 | int temp = arr[j]; |
| 43 | arr[j] = arr[j+1]; |
| 44 | arr[j+1] = temp; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | public static void printArr(int arr[]) { |
| 51 | for(int i=0; i<arr.length; i++) { |