Well, kind of. That's where the -1 index is coming from, obviously. However taking this line out would make your binary search (well, anybody's binary search) completely and irretrievably broken, as this the only way you stop searching (unless you luck into finding the actual data, which you haven't been doing).