Tengo un problema con mi codigo en Java. Necesito ordenar una matriz de manera recursiva

public static void main(String[] args) {
   int m [][] = {
       {62,29,35,40,52},
       {60,70,80,92,10},
       {11,12,13,14,15},
       {16,17,18,19,20},
       {21,22,23,24,25}
}; /**
   for (int i=0; i<5; i++){
        for (int j=0; j<5; j++){
            for(int x=0; x<5;x++){
               for(int y=0; y<5;y++){
                if (m[i][j]<m[x][y]){
                    int t = m[i][j];
                    m[i][j]=m[x][y];
                    m[x][y] = t;
                }
            } 
            }
        }
     
}*/
    oredenarMatrizRecursiva(m,0,0,0,0);
    recursivaMatriz(m,0,0);
    
   
   /** System.out.print("----------"+"\n");
    for (int i=0; i<5;i++){
        for (int j=0; j<5;j++){
            System.out.print(m[i][j]+" ");
            
    } 
        System.out.print(" "+"\n");
    }*/
   
   
  
   
 
   
   
   
   
   
}

public static void recursivaMatriz(int [][] m, int i, int j){
System.out.print(m[i][j]+" ");

    if (i!=m.length-1 || j!=m[i].length-1){
      if (j==m[1].length-1){
          i++;
          j=0;
          System.out.println();
      }else{
          j++;
          
      }
          
       recursivaMatriz(m, i,j ); 
       
       
        
    }
    
    
}



public static int[][] oredenarMatrizRecursiva(int [][] m, int i,int j, int x, int y){
    
    
    if (j<=m.length-1 && y<=m.length-1){
        if (i<=m.length-j-1 && x<=m.length-y-1){
    
            if (m[i][j]<m[x][y]){
                    int t = m[i][j];
                    m[i][j]=m[x][y];
                    m[x][y] = t;
                }
            return oredenarMatrizRecursiva(m,i+1,j,x+1,y);
    }else{
            i=0; 
            x=0; 
            return oredenarMatrizRecursiva(m,i,j+1,x,y+1);
            
        }
    }else{
        return m;
    }
    
                    
     
    
    
}