Java Array Sort sort(Double[] inArray)

Here you can find the source of sort(Double[] inArray)

Description

A simple Insertion sort performed on an array of doubles

License

Open Source License

Parameter

Parameter Description
inArray a parameter

Declaration

public static void sort(Double[] inArray) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//  www .  j a v  a 2  s  . c o  m
     *A simple Insertion sort performed on an array of doubles
     * @param inArray
     */
    public static void sort(Double[] inArray) {
        int idx = 0;
        int j;
        double x;
        for (int i = 1; i < inArray.length; i++) {
            j = i;
            x = inArray[i];
            while ((j > 0) && (inArray[j - 1] > x)) {
                inArray[j] = inArray[j - 1];
                j--;
            }
            inArray[j] = x;

        }
    }
}

Related

  1. sort(double s[], int idx[])
  2. sort(double[] a, int[] b)
  3. sort(double[] coords1, int length1, double[] coords2, int length2, int[] array)
  4. sort(double[] data)
  5. sort(double[] data, boolean desc)
  6. sort(double[] vector, boolean ascending)
  7. sort(double[] x)
  8. sort(E[] x, int[] w)
  9. sort(final double[] data)