fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. int arr[][] = {{3,4,7},{1,3,4},{1,3,2},{1,2,2}};
  14. for (int i = 0; i < arr.length;++i) {
  15. for (int j = 0; j < arr[i].length;++j)
  16. System.out.print(arr[i][j]);
  17. System.out.println();
  18. }
  19. Arrays.sort(arr, (a,b)-> {
  20. return a[2] - b[2];
  21. });
  22. System.out.println();
  23. for (int i = 0; i < arr.length;++i) {
  24. for (int j = 0; j < arr[i].length;++j)
  25. System.out.print(arr[i][j]);
  26. System.out.println();
  27. }
  28. }
  29. }
Success #stdin #stdout 0.09s 36500KB
stdin
Standard input is empty
stdout
347
134
132
122

132
122
134
347