Java Array Sort sort(double[] x)

Here you can find the source of sort(double[] x)

Description

sort

License

Apache License

Declaration

public static int[] sort(double[] x) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int[] sort(double[] x) {
        int[] id = new int[x.length];
        boolean[] fid = new boolean[id.length];
        int cnt = 0;
        for (int i = 0; i < id.length; i++) {
            int mi = 0;
            double min = x[mi];
            for (int j = 0; j < x.length; j++) {
                if (fid[j]) {
                    continue;
                }//from   w  ww  .  j  a  v  a 2  s . c  o m
                if (fid[mi]) {
                    mi = j;
                    min = x[j];
                } else {
                    if (min > x[j]) {
                        mi = j;
                        min = x[j];
                    }
                }
            }
            fid[mi] = true;
            id[cnt++] = mi;
        }
        return id;
    }
}

Related

  1. sort(double[] coords1, int length1, double[] coords2, int length2, int[] array)
  2. sort(double[] data)
  3. sort(double[] data, boolean desc)
  4. sort(Double[] inArray)
  5. sort(double[] vector, boolean ascending)
  6. sort(E[] x, int[] w)
  7. sort(final double[] data)
  8. sort(final int[] data)
  9. sort(final long[] primary, final double[] secondary)