Tim Bray has a good post up on binary search, but prefaces it with this:
Anyone who regards themselves as a serious programmer has internalized a lot of different ways of searching: hash tables, binary, and many different kinds of trees. I've used pretty well all of these seriously at some point, but for a decade or so, as far as can I recall I've used almost exclusively binary search, and I see no reason to change that. Herewith an essay for programmers, with fully-worked out examples in Java, on why. [Updated 39 months after publishing when I read with horror Josh Bloch’s exposé of a long-lurking bug. If we can’t get binary search right, what chance do we have with real software?]
As I said here, the code is fine. That type system you're using with Java? Not so much. Patrick Logan makes a related point here. The chances of getting software right will improve a whole heck of lot if we just stop using broken tools.