Here you can find the source of sortInterval(byte[] x, int start, int end)
static byte[] sortInterval(byte[] x, int start, int end)
//package com.java2s; //License from project: Open Source License public class Main { static byte[] sortInterval(byte[] x, int start, int end) { assert start <= end; assert end <= x.length; final byte[] result = x.clone(); final int[] counter = new int[256]; for (int i = start; i < end; i++) { final int b = unsigned(x[i]); counter[b]++;//www . j a va 2 s . co m } int index = start; for (int i = 0; i < 256; i++) { for (int j = 0; j < counter[i]; j++) result[index++] = (byte) i; } return result; } static int unsigned(byte b) { return b & 0xff; } }