public static double[][] doubleSelectionSort(double[][] aa){
            int index = 0;
            int lastIndex = -1;
            int n = aa[0].length;
            double holdx = 0.0D;
            double holdy = 0.0D;
            double[][] bb = new double[2][n];
            for(int i=0; i<n; i++){
                bb[0][i]=aa[0][i];
                bb[1][i]=aa[1][i];
            }


            while(lastIndex != n-1){
                index = lastIndex+1;
                for(int i=lastIndex+2; i<n; i++){
                    if(bb[0][i]<bb[0][index]){
                        index=i;
                    }
                }
                lastIndex++;
                holdx=bb[0][index];
                bb[0][index]=bb[0][lastIndex];
                bb[0][lastIndex]=holdx;
                holdy=bb[1][index];
                bb[1][index]=bb[1][lastIndex];
                bb[1][lastIndex]=holdy;

            }
            return bb;
        }