Function to Convert given Matrix into sorted Spiral Matrix
function convertMatrixToSortedSpiral ( y , m , n ) { let a = new Array ( MAX ) ; for ( let i = 0 ; i < MAX ; i ++ ) a [ i ] = new Array ( MAX ) ; let x = new Array ( m * n ) ; x = convert2Dto1D ( y , m , n ) ; x = SortArray ( x ) ; ToSpiral ( m , n , x , a ) ; PrintMatrix ( a , m , n ) ; }