Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lexisort
import java.util.*; class Rextester { public static void main(String args[]) { int[][] array={{3,0},{1,2},{2,2},{3,2},{0,3},{2,3} }; Arrays.sort(array, new Comparator<int[]>(){ public int compare(int[] a, int[] b){ int x,y; if (a[0]!=b[0]) { x=a[0];y=b[0]; } else{ x=a[1];y=b[1]; } if (x<y) return -1; else if (x==y) return 0; else return +1; } }); for(int[] term: array){ System.out.println(Arrays.toString(term)); } } }
run
|
edit
|
history
|
help
0
fizzbuzz
Complex number multiplication (leetcode)
Find Median in Large File of Integers
Largest prime factor
java palindrome check
1a
Convert ArrayList to array in java
log
qwe
jb14.0 lyambds