Swap if previous value is greater
int temp = data [ j / col , j % col ] ; data [ j / col , j % col ] = data [ ( j + 1 ) / col , ( j + 1 ) % col ] ; data [ ( j + 1 ) / col , ( j + 1 ) % col ] = temp ; } } } } static void printMat ( int [ , ] mat , int row , int col ) {