Here you can find the source of quickSort(short[] fireZoneInfo, int left, int right)
public static void quickSort(short[] fireZoneInfo, int left, int right)
//package com.java2s; //License from project: Apache License public class Main { /**//w w w.j a v a2s. c om * Does a quick sort on the given array * * @author Hesam 002 */ public static void quickSort(short[] fireZoneInfo, int left, int right) { int index = partition(fireZoneInfo, left, right); if (left < index - 1) quickSort(fireZoneInfo, left, index - 1); if (index < right) quickSort(fireZoneInfo, index, right); } /** * Partitions the array for quick sort * * @author Hesam 002 */ public static int partition(int arr[], int left, int right) { int i = left, j = right; int tmp; int pivot = arr[(left + right) / 2]; while (i <= j) { while (arr[i] < pivot) i++; while (arr[j] > pivot) j--; if (i <= j) { tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; i++; j--; } } return i; } /** * Partitions the array for quick sort * * @author Hesam 002 */ public static int partition(short arr[], int left, int right) { int i = left, j = right; short tmp; int pivot = arr[(left + right) / 2]; while (i <= j) { while (arr[i] < pivot) i++; while (arr[j] > pivot) j--; if (i <= j) { tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; i++; j--; } } return i; } }