Here you can find the source of insertionsort(double[] a, int[] b, int p, int r)
protected static final void insertionsort(double[] a, int[] b, int p, int r)
//package com.java2s; public class Main { protected static final void insertionsort(double[] a, int[] b, int p, int r) { for (int j = p + 1; j <= r; ++j) { double key = a[j]; int val = b[j]; int i = j - 1; while (i >= p && a[i] > key) { a[i + 1] = a[i];/*from w w w .ja v a 2 s. c om*/ b[i + 1] = b[i]; i--; } a[i + 1] = key; b[i + 1] = val; } } protected static final void insertionsort(long[] a, int[] b, int p, int r) { for (int j = p + 1; j <= r; ++j) { long key = a[j]; int val = b[j]; int i = j - 1; while (i >= p && a[i] > key) { a[i + 1] = a[i]; b[i + 1] = b[i]; i--; } a[i + 1] = key; b[i + 1] = val; } } protected static final void insertionsort(int[] a, int[] b, int p, int r) { for (int j = p + 1; j <= r; ++j) { int key = a[j]; int val = b[j]; int i = j - 1; while (i >= p && a[i] > key) { a[i + 1] = a[i]; b[i + 1] = b[i]; i--; } a[i + 1] = key; b[i + 1] = val; } } }