从数组中获取MIN和MAX并将其删除以用于Java

时间:2015-10-16 04:40:28

标签: java arrays max min

我正在做一项任务,要求我创建一个输入分数的GUI。然后我必须取得那些分数,删除MIN和MAX值并平均分数。如何找到MIN和MAX分数然后从阵列中删除它们?

            iaRun1[0] = Integer.parseInt(judgeOneRunOne.getText());
            iaRun1[1] = Integer.parseInt(judgeTwoRunOne.getText());
            iaRun1[2] = Integer.parseInt(judgeThreeRunOne.getText());
            iaRun1[3] = Integer.parseInt(judgeFourRunOne.getText());
            iaRun1[4] = Integer.parseInt(judgeFiveRunOne.getText());
            iaRun1[5] = Integer.parseInt(judgeSixRunOne.getText());
            iaRun2[0] = Integer.parseInt(judgeOneRunTwo.getText());
            iaRun2[1] = Integer.parseInt(judgeTwoRunTwo.getText());
            iaRun2[2] = Integer.parseInt(judgeThreeRunTwo.getText());
            iaRun2[3] = Integer.parseInt(judgeFourRunTwo.getText());
            iaRun2[4] = Integer.parseInt(judgeFiveRunTwo.getText());
            iaRun2[5] = Integer.parseInt(judgeSixRunTwo.getText());

    //How do I get MIN and MAX values and delete them?

    // The average for run 1
    for (int i = 0; i < iaRun1.size(); i++) {
        dTotal1 += iaRun1.get(i);
        dAvg1 = dTotal1 / iaRun1.size();
    }


    // The average for run 2
    for (int j = 0; j < iaRun2.size(); j++) {
        dTotal2 += iaRun2.get(j);
        dAvg2 = dTotal2 / iaRun2.size();
    }

0 个答案:

没有答案