Object> Java中有将二维数组转化为二维的List的方法吗 > ArrayList< 的方式 即ArrayList< (objection逆转裁判)
import ;public class Test { public static void main(String[] args) {//初始化一个测试的二维数组int[][] a = new int[][] { { 34,234,543,2,42,224 }, { 234,56,88,241,564,234,555,24 }, { 13,444,534,76,9999,894,34 } };(max value is: + getMaxValue1(a));(max value is: + getMaxValue2(a)); } /*** 方法1:遍历二维数组的一切的元素与以后最大的值比拟,并记载*/ static int getMaxValue1(int[][] a){int maxValue = 0;//用于记载当然最大值if(a!=null && !=0) for (int[] a1 : a) {for (int i : a1) { if(maxValue<i)maxValue = i;} }return maxValue; } /*** 方法2:对子数组启动排序,而后比拟子数组中最大的值。当然这里只求最大值也没必要排序-_-!!,只是表现了一种思维*/ static int getMaxValue2(int[][] a){int maxValue = 0;if(a!=null && !=0) for (int[] a1 : a) {(a1);//对a1启动排序,升序的if(maxValue<a1[-1])maxValue = a1[-1];//比拟子数组中最大的值 }return maxValue; } }