Function to sort boundary elements of a matrix starting from the outermost to the innermost boundary and place them in a clockwise manner
static void sortBoundaryWise ( ArrayList < ArrayList < Integer > > a ) {