public static double[] sort(double[] data, boolean desc){
        for(int i = 0; i < data.length - 1; i++){
            for(int j = 0; j < data.length - i - 1; j++){
                if(desc){
                    if(data[j] < data[j + 1]){
                        double tmp = data[j];
                        data[j] = data[j + 1];
                        data[j + 1] = tmp;
                    }
                }else{
                    if(data[j] > data[j + 1]){
                        double tmp = data[j];
                        data[j] = data[j + 1];
                        data[j + 1] = tmp;
                    }
                }
            }
        }
        return data;
    }