find index of given key using binary search
The guaranteed performance is in O(log n) comparisons.
result is the index where key was found or nil if key is not
in this array. In case several instance equal to key are in
this sortedArray, the index of one of the matching keys will be
returned, but is not specified which one.