@@ -0,0 +1,371 @@
+import java.util.Arrays;%0A%0Apublic class BinarySearch%0A%7B%0A%09public static int rank(int key, int%5B%5D a)%0A%09%7B%0A%09%09int lo = 0;%0A        int hi = a.length - 1;%0A        while (lo %3C= hi)%0A        %7B%0A            int mid = lo + (hi - lo) / 2;%0A            if (key %3C a%5Bmid%5D) hi = mid - 1;%0A            else if (key %3E a%5Bmid%5D) lo = mid + 1;%0A            else return mid;%0A        %7D%0A%09%7D%0A%0A    public %0A%7D%0A

add BinarySearch.java