I have an array of java objects.
- Each object stores two longs that define a number range.
- I already have a guarantee that for all the objects in the range, the number ranges don't overlap.
I want a quick of finding a particular object in the array, given a number which may (or may not) fall within one of the number ranges defined by the objects.
I was hoping to do this using Array.binarySearch but that doesn't look appropriate.
Any thoughts on the best way to do this?