code: private static void radixPass(int[] src, int[] dst, int[] v, int vi,
                                    final int n, final int K, int start, int[] cnt) {
          // check counter array's size.
          assert cnt.length >= K + 1;
          Arrays.fill(cnt, 0, K + 1, 0);
  
          // count occurrences
          for (int i = 0; i < n; i++)
              cnt[v[start + vi + src[i]]]++;
  
          // exclusive prefix sums
          for (int i = 0, sum = 0; i <= K; i++) {
              final int t = cnt[i];
              cnt[i] = sum;
              sum += t;
          }
  
          // sort
          for (int i = 0; i < n; i++)
              dst[cnt[v[start + vi + src[i]]]++] = src[i];
      }
docs: Stably sort indexes from src[0..n-1] to dst[0..n-1] with values in 0..K from v. A
  constant offset of <code>vi</code> is added to indexes from src.