Here you can find the source of quickSort(int[] a, int start, int end)
public static void quickSort(int[] a, int start, int end)
//package com.java2s; //License from project: Open Source License public class Main { public static void quickSort(int[] a, int start, int end) { int length = end - start + 1; System.out.println(String.format("start:%s, end:%s, length:%s ", start, end, length)); if (length <= 1) { return; }/*from w w w .j a v a2s .co m*/ int b[] = new int[length]; int k = 1, j = 0; for (int i = start + 1; i <= end; i++) { if (a[i] > a[start]) { b[length - k] = a[i]; k++; } else { b[j] = a[i]; j++; } } b[j] = a[start]; System.arraycopy(b, 0, a, start, length); print(a, 0, a.length); if (length == 2) { return; } quickSort(a, start, start + j - 1); quickSort(a, start + j + 1, end); } public static void print(int a[], int start, int length) { for (int j = start; j < (start + length); j++) { System.out.print(a[j] + "\t"); } System.out.println(); } }