private static int binarySearch(final Namespace[] data,
                                  int left, int right, final Namespace key) {
    // assume all input is valid. No need to waste time checking.

    //		Because we are always searching inside of the scope array, and
    //		because there's always at least two scope members, we will always have
    //		a minimum value of 2 for 'right', and a maximum value of 1 for 'left'
    //		thus the following check is never needed.
    //
    //		if (left >= right) {
    //			// we are searching in nothing, return the correct value
    //			// ... this is where IBM's JDK is broken - it just returns -1
    //			return -left - 1;
    //		}
    // make the right-side 'inclusive' instead of 'exclusive'
    right--;

    while (left <= right) {
      // get the mid-point. See the notes on the binary-search bug...
      // ... not that we'll ever have that many Namspaces.... ;-)
      // http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html
      final int mid = (left + right) >>> 1;
      if (data[mid] == key) {
        // exact namespace match.
        return mid;
      }
      final int cmp = NSCOMP.compare(data[mid], key);

      if (cmp < 0) {
        left = mid + 1;
      }
      else if (cmp > 0) {
        right = mid - 1;
      }
      else {
        // Namespace prefix match.
        return mid;
      }
    }
    return -left - 1;
  }
private static int binarySearch(final Namespace[] data,
                                  int left, int right, final Namespace key)