Here you can find the source of insertionSort(double[] a, int low, int high)
public static void insertionSort(double[] a, int low, int high)
//package com.java2s; //License from project: Apache License public class Main { public static void insertionSort(double[] a, int low, int high) { for (int p = low + 1; p <= high; p++) { double tmp = a[p]; int j; for (j = p; j > low && tmp < (a[j - 1]); j--) { a[j] = a[j - 1];/* w w w .j a v a 2 s .c o m*/ } a[j] = tmp; } } /** * Internal insertion sort routine for subarrays that is used by quicksort. * * @param a * an array of Comparable items. * @param low * the left-most index of the subarray. * @param n * the number of items to sort. */ private static <T extends Comparable<T>> void insertionSort(T[] a, int low, int high) { for (int p = low + 1; p <= high; p++) { T tmp = a[p]; int j; for (j = p; j > low && tmp.compareTo(a[j - 1]) < 0; j--) { a[j] = a[j - 1]; } a[j] = tmp; } } }