Function to Convert given Matrix into sorted Spiral Matrix
public static void convertMatrixToSortedSpiral ( int y [ ] [ ] , int m , int n ) { int a [ ] [ ] = new int [ MAX ] [ MAX ] ; int x [ ] = new int [ m * n ] ; x = convert2Dto1D ( y , m , n ) ; x = SortArray ( x ) ; ToSpiral ( m , n , x , a ) ; PrintMatrix ( a , m , n ) ; }