public static String[][] run(String train, String test) {
        int k = 3;
        // read the train file
        //String inputtrainf="IrisTrain.csv";
        //String inputtestf="IrisTest.csv";
        String inputtrainf=train;
        String inputtestf=test;
        ArrayList<String> trainList = getFile(inputtrainf);
        int trainSize = trainList.size() - 6;
        String trainData[][] = new String[trainSize][6];
        String trainDatares[][] = new String[trainSize][6];

        // trainData[i][j] is the whole array to store the file
        for (int i = 0; i < trainSize; i++) {
            trainData[i] = trainList.get(i + 6).split(",");
        }

        // read the test file
        ArrayList<String> testList = getFile(inputtestf);
        int testSize = testList.size() - 6;
        String testData[][] = new String[testSize][4];
        for (int i = 0; i < testSize; i++) {
            testData[i] = testList.get(i + 6).split(",");
        }

        // transfer String to double and put to array myIris[][]
        double myIris[][] = new double[testData.length][4];
        for (int i = 0; i < testData.length; i++) {
            for (int j = 0; j < 4; j++) {
                myIris[i][j] = Double.parseDouble(testData[i][j]);
            }
        }
        

        // put the classification result into array result
        String result[] = new String[testData.length];
        
        for (int i = 0; i < testData.length; i++) {
            // sum[] is the sqrt list of each Iris' distance
            double sum[] = getDistance(myIris[i], trainData,trainDatares);
            int[] theFirstK = getFirstK(sum, k);

            // vote record the number of votes
            int[] vote = new int[k];
            vote = vote(trainData, theFirstK, k, vote);

            String winner = max(vote[0], vote[1], vote[2]);
            result[i] = winner;
        }

        try {
            writeToFile(testData, result);
        } catch (IOException e) {
            System.out.println("File write error");
            e.printStackTrace();
        }
        return trainDatares;

    }