使用迭代计数填充2D

时间:2017-04-30 20:38:58

标签: java arrays loops

public void getSort(int []order, int[] chaos ){
        //int order has a list of numbers 0,5
        //chaos has a list of numbers 0,5  


    for (int s: order) {   


    int count = 0;
        for (int i = 0;i< chaos.length ;i++ )
        {

            if(chaos[i]==(s))
            {
                count++;
        }

    }
System.out.println("Score " +s+" Occur "+count);
    }
}

我需要帮助保持检查当前号码,并检查该号码的当前计数。 我想将它们放入2D数组中以执行操作。

我尝试通过创建一个返回字符串的方法将输出转换为字符串,但是返回了最后检查的数字。 我想要捕获system.out,但无论如何我需要数组中的数据。

0 个答案:

没有答案
相关问题