123
public class QuickSort { public static void main(String args[]){ int[] array = {2,6,1,9,4,3,23,65,0,7}; System.out.print("the array before is:"); for(int i = 0; i < array.length; i++){ System.out.print(array[i]+" "); } System.out.println(" "); System.out.print("the array after is:"); quickSort(array); } static void quickSort(int[] array){ int len = array.length; for(int i = 0; i < len; i++){ for(int j = i; j < len; j++){ if(array[j] < array[i]){ for(int k = j; k > i; k--){ int temp = array[k]; array[k] = array[k-1]; array[k-1] = temp; } } } for(int w = 0; w < len; w++){ System.out.print(array[w]+" "); } System.out.println(" "); } } }