public static void sort2(Tuple[] arr) {
        int R = 256;
        int[] count = new int[R + 1];
        Tuple[] aux = new Tuple[arr.length];

        //Compute frequency counts
        for (Tuple t : arr) {
            count[t.value + 1] += 1;
        }
        //Transform counts to indices
        for (int i = 0; i < R; i++) {
            count[i + 1] += count[i];
        }
        //Distribute records
        for (Tuple t : arr) {
            aux[count[t.value]++] = t;
        }
        //Copy records
        for (int i = 0; i < arr.length; i++)
            arr[i] = aux[i];
    }