Here you can find the source of sort(double[] x)
public static int[] sort(double[] x)
//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; } }