title: Last index of multiple keys using binary-search?
body: <p>i have multiple occurrences of a key in a sorted array, and i want to perform binary search on them, a normal binary search returns some random index for the key having multiple occurrences, where as i want the index of the last occurrence of that key.</p>
  
  <pre><code>int data[] = [1,2,3,4,4,4,4,5,5,6,6];
  int key = 4;
  int index = upperBoundBinarySearch(data, 0, data.length-1, key);
  
  Index Returned = 6
  </code></pre>