How would I use a recursive binary search to sort a list of unsorted numbers e.g.

5 29 17 3 6 43

My code for the recursive binary search is....

public static int bSearch(int[] a, int lo, int hi, int key) { int mid = (lo+hi)/2; if(lo>hi) return -1; else if (a[mid]==key) return mid; else if (a[mid]<key) return bSearch(a, mid+1, hi, key); else return bSearch(a, lo, mid-1, key); }

My insert in order method would be....

static void insertInOrder( int[] arr, int cnt, int newVal ) { int index = -( bSearch( arr, 0, arr.length-1, newVal)) - 1; //Stuck here ******************** }