import java.util.Arrays; public class sk1 { public static void main(String[] args){ int [][] two = {{1,2,3},{4,10},{2,5,8}}; int[] result = merge(two); for(int i =0; i < result.length; i++){ System.out.print(result[i]+","); } } /** * k-way merge */ public static int[] merge(int[][] input){ int[] int1d;//1维数组 int len = 0;//1维数组的集合长度 for (int[] element : input) { len += element.length; } int1d = new int[len]; int index = 0; //标记 for (int [] i : input) { for (int j : i) { int1d[index++] = j; } } Arrays.sort(int1d); return int1d; } }