Here you can find the source of quicksort(float[] a, int[] index, int left, int right)
private static void quicksort(float[] a, int[] index, int left, int right)
//package com.java2s; //License from project: Open Source License public class Main { private static void quicksort(float[] a, int[] index, int left, int right) { if (right <= left) { return; }/*from ww w . j a va2s . c om*/ int i = partition(a, index, left, right); quicksort(a, index, left, i - 1); quicksort(a, index, i + 1, right); } private static int partition(float[] a, int[] index, int left, int right) { int i = left - 1; int j = right; while (true) { // find item on left to swap while (a[index[++i]] < a[index[right]]) ; // a[right] acts as sentinel // find item on right to swap while (a[index[right]] < a[index[--j]]) { // don't go out-of-bounds if (j == left) { break; } } // check if pointers cross if (i >= j) { break; } swap(a, index, i, j); // swap two elements into place } swap(a, index, i, right); // swap with partition element return i; } private static void swap(float[] a, int[] index, int i, int j) { int tmp = index[i]; index[i] = index[j]; index[j] = tmp; } }