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. int arg[][] = {
  13. {26, 39, 3, 13},
  14. {22, 97, 17, 123},
  15. {46, 19, 63, 123},
  16. {1, 37, 90, 32},
  17. {17, 37, 90, 32}};
  18. try{
  19.  
  20. for (int i = arg[0].length - 1; i >= 0; i--) {
  21. for (int j = 0; j < arg.length ; j++) {
  22. for (int k = 0; k < arg[j].length-1 ; k++) {
  23. // System.out.print(""+k+ " "+j);
  24. if (arg[j][k] > arg[j][k + 1]) {
  25. int temp = arg[j][k];
  26. arg[j][k] = arg[j][k + 1];
  27. arg[j][k + 1] = temp;
  28.  
  29. }
  30. }
  31. // System.out.println();
  32. }
  33. }
  34.  
  35. for (int i = 0; i < arg.length; i++) {
  36. for (int j = 0; j < arg[i].length; j++) {
  37. System.out.print(arg[i][j] + " ");
  38. }
  39. System.out.println();
  40. }
  41. }catch(Exception e){
  42. System.out.println(e);
  43. }
  44. }
  45. }
Success #stdin #stdout 0.1s 320320KB
stdin
Standard input is empty
stdout
3 13 26 39 
17 22 97 123 
19 46 63 123 
1 32 37 90 
17 32 37 90