这里强烈推荐一个博主写的二分搜索总结:http://www.cnblogs.com/grandyang/p/6854825.html
参考链接:
https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/discuss/188002/Java-clean-code-that-beats-100
https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/solution/