Here you can find the source of countingSort(int[] array, int low, int high)
public static void countingSort(int[] array, int low, int high)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static void countingSort(int[] array, int low, int high) { int[] counts = new int[high - low + 1]; // this will hold all possible values, from low to high for (int x : array) counts[x - low]++; // - low so the lowest possible value is always 0 int current = 0; for (int i = 0; i < counts.length; i++) { Arrays.fill(array, current, current + counts[i], i + low); // fills counts[i] elements of value i + low in current current += counts[i]; // leap forward by counts[i] steps }/*from ww w . j a v a 2 s . co m*/ } }