Here you can find the source of quicksort(final long[] data, final int left, final int right)
public static void quicksort(final long[] data, final int left, final int right)
//package com.java2s; public class Main { public static void quicksort(final long[] data, final int left, final int right) { if (data == null || data.length < 2) return; int i = left, j = right; long x = data[(left + right) / 2]; do {/*from w w w . j av a2 s .c o m*/ while (data[i] < x) i++; while (x < data[j]) j--; if (i <= j) { long temp = data[i]; data[i] = data[j]; data[j] = temp; i++; j--; } } while (i <= j); if (left < j) quicksort(data, left, j); if (i < right) quicksort(data, i, right); } public static void quicksort(final double[] data) { quicksort(data, 0, data.length - 1); } public static void quicksort(final double[] data, final int left, final int right) { if (data == null || data.length < 2) return; int i = left, j = right; double x = data[(left + right) / 2]; do { while (data[i] < x) i++; while (x < data[j]) j--; if (i <= j) { double temp = data[i]; data[i] = data[j]; data[j] = temp; i++; j--; } } while (i <= j); if (left < j) quicksort(data, left, j); if (i < right) quicksort(data, i, right); } public static void quicksort(final float[] data) { quicksort(data, 0, data.length - 1); } public static void quicksort(final float[] data, final int left, final int right) { if (data == null || data.length < 2) return; int i = left, j = right; float x = data[(left + right) / 2]; do { while (data[i] < x) i++; while (x < data[j]) j--; if (i <= j) { float temp = data[i]; data[i] = data[j]; data[j] = temp; i++; j--; } } while (i <= j); if (left < j) quicksort(data, left, j); if (i < right) quicksort(data, i, right); } public static void quicksort(final double[] data, final int[] sortAlso, final int left, final int right) { if (data == null || data.length < 2) return; int i = left, j = right; double x = data[(left + right) / 2]; do { while (data[i] < x) i++; while (x < data[j]) j--; if (i <= j) { double temp = data[i]; data[i] = data[j]; data[j] = temp; int temp2 = sortAlso[i]; sortAlso[i] = sortAlso[j]; sortAlso[j] = temp2; i++; j--; } } while (i <= j); if (left < j) quicksort(data, sortAlso, left, j); if (i < right) quicksort(data, sortAlso, i, right); } }