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)
  11. {
  12. int[][] matriz = {{18,20,14},{2,7,19},{21,2,1}};
  13.  
  14. int aux;
  15.  
  16.  
  17.  
  18. for (int x=0; x < matriz.length ; x++)
  19. {
  20. for (int y=0; y < matriz[x].length ; y++)
  21. {
  22.  
  23. for (int a=0; a < matriz.length; a++)
  24. {
  25. for (int b=0; b < matriz[a].length ;b++)
  26. {
  27. if (matriz[a][b] >= matriz[x][y])
  28. {
  29. aux = matriz[x][y];
  30. matriz[x][y] = matriz[a][b];
  31. matriz[a][b] = aux;
  32.  
  33. }
  34.  
  35.  
  36.  
  37. }
  38.  
  39.  
  40. }
  41.  
  42. }
  43.  
  44. }
  45.  
  46. for (int i=0; i < matriz.length ; i++)
  47. {
  48. System.out.println("");
  49.  
  50. for(int j = 0; j < matriz[i].length ; j++)
  51. {
  52. System.out.print(" "+matriz[i][j]);
  53. }
  54.  
  55. }
  56. }
  57. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
 1 2 2
 7 14 18
 19 20 21