The method of sorting java array
This article mainly introduces "the method of sorting java array". In the daily operation, I believe that many people have doubts about the method of sorting java array. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "the method of sorting java array". Next, please follow the editor to study!
/ * swap the location of the two specified subscript elements in the array * @ param arr the array reference address value of the elements to be exchanged * @ param an array index * @ param b array index * / private static void swap (int [] arr,int aline int b) {int temp=arr [a] Arr [a] = ARR [b]; arr [b] = temp } / * * Bubble sort * @ param arr the array to be sorted refers to the address value * @ param type true to sort, and false to sort in reverse order * / public static void bubbleSort (int [] arr) Boolean type) {if (type) {for (int iTun0) I