Here you can find the source of quickSort(int[] array, int lo0, int hi0)
private static void quickSort(int[] array, int lo0, int hi0)
//package com.java2s; /*// w w w . j a va2 s. c o m * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. */ public class Main { private static void quickSort(int[] array, int lo0, int hi0) { int lo = lo0; int hi = hi0; int mid; if (hi0 > lo0) { mid = array[(lo0 + hi0) / 2]; while (lo <= hi) { while ((lo < hi0) && (array[lo] < mid)) ++lo; while ((hi > lo0) && (array[hi] > mid)) --hi; if (lo <= hi) { swap(array, lo, hi); ++lo; --hi; } } if (lo0 < hi) quickSort(array, lo0, hi); if (lo < hi0) quickSort(array, lo, hi0); } } public static void swap(final Object[] array, int pos) { swap(array, pos, pos + 1); } public static void swap(final Object[] array, int pos, boolean forward) { int pos2 = (forward) ? pos + 1 : pos - 1; swap(array, pos, pos2); } public static void swap(final Object[] array, int pos, int pos2) { if (pos == pos2) return; Object temp = array[pos]; array[pos] = array[pos2]; array[pos2] = temp; } public static void swap(final int[] array, int pos, int pos2) { if (pos == pos2) return; int temp = array[pos]; array[pos] = array[pos2]; array[pos2] = temp; } }