java中用for循环求一个数组中出现最多次数的元素答:// 测试数组int[] array = {2,4,6,8,2,5,8,2,10};HashMap<Integer, Integer> hashMap = new HashMap<Integer, Integer>();for (int i : array) {hashMap.put(i, hashMap.get(i) == null ? 0 :hashMap.get(i)+1);}Set<Integer> keySet = hashMap.keySet();int maxKey =...
Java 求问一下怎样求int数组中连续出现最多次数的数~并输出出现了多少次...答:public static void main (String args[]){ int[] array = new int[]{5,1,1,1,3,3,3,6,7,7,8,8,8,8,9,1,2,3,4,4};//连续出现最多的数 int more = 0;//连续出现最多的次数 int moreCount = 0;//当前连续出现的次数 int tempCount = 0;//上一次取出的数 int before ...