两组数据比如
12 13 14
1 2 3
根据第一列排序并且关联后面的怎么搞,而且第一列可能重复 

解决方案 »

  1.   

    其实类似hashmap排序,但是key有重复,而且值可以有多个,明白了 吧
      

  2.   

    二维数组,按每一行第一个元素排序,不知道理解的对吗
    使用冒泡排序的方法public class SortDemo 
    {
    public static void main(String[] args) 
    {
    int[][] arr = {{12, 13, 14},{1,2,3}}; showArray(arr);System.out.println(); for(int i=1; i<arr.length; i++) {
    for(int j=0; j<arr.length-i; j++) {
    if(arr[j][0] > arr[j+1][0]) {
    swap(arr, j, j+1);
    }
    }
    } showArray(arr);
    } public static void swap(int[][] arr, int a, int b) {
    int[] tmp = arr[a];
    arr[a] = arr[b];
    arr[b] = tmp;
    } public static void showArray(int[][] arr) {
    for(int i=0; i<arr.length; i++) {
    for(int j=0; j<arr[i].length; j++) {
    System.out.print(arr[i][j] + " ");
    }
    System.out.println();
    }
    }
    }