数组----三谈二维数组的排序
2014-02-21 21:55
267 查看
static int[][] seq_int = { {2349,12,420,549,120,3,23}, {1,30,84,693,29,4,4}, {7,239,943,82,32,492}, {2,4,234,5920,2019,40234}, {5,603,582,6928,923752,234}, {9,509,2392,95,102,402,2} }; public static void main(String[] args) { Arrays.sort(seq_int, new Comparator<int[]>(){ public int compare(int[] o1, int[] o2) { Arrays.sort(o1); Arrays.sort(o2); return o1[0] - o2[0]; } }); System.out.println(Arrays.deepToString(seq_int)); }
output: [[1, 4, 4, 29, 30, 84, 693], [2, 4, 234, 2019, 5920, 40234], [2, 9, 95, 102, 402, 509, 2392], [3, 12, 23, 120, 420, 549, 2349], [5, 234, 582, 603, 6928, 923752], [7, 32, 82, 239, 492, 943]]
相关文章推荐
- 一个好看一点的listview
- ubuntu下用apt-get安装lamp缺少mcrypt , curl
- linux 常用命令 自己 积累
- Facebook190亿美元收购WhatsApp
- Jdk5.0新特性
- fdisk交互式划分磁盘分区示例
- 2459: 爱你多少年呢
- Linux下后台执行shell命令
- 查询_修改SQL Server 2005中数据库文件存放路径
- Extjs GridPanel 监听事件 行选中背景
- 委托模式的重新理解
- oracle 数据库查询关联运算
- 各大互联网公司市值
- 参数
- struts2自动类型转换问题
- PAT 1016
- PHP支付宝接口RSA验证
- Windows程序设计--第一个窗口程序
- Android内存管理机制详解
- USB设备驱动程序(四)