function to print half of the array in ascending order and the other half in descending order
static void printOrder ( int [ ] arr , int n , int k ) { int len2 = n - k ; int [ ] arr1 = new int [ k ] ; int [ ] arr2 = new int [ n - k ] ;