@@ -0,0 +1,997 @@
+package io.nnyy.algorithms.BinarySearch;%0A%0Apublic class BinarySearch %7B%0A    /**%0A     * The following method will search for the first occurrance of int %7B@paramref target%7D%0A     * in sorted array %7B@paramref nums%7D.  If %7B@paramref target%7D cannot be found, then it%0A     * will return the last number smaller than %7B@paramref target%7D, as long as it exists;%0A     * otherwise it will return -1.%0A     * @param nums A sorted int array.%0A     * @param target The int to search in %7B@paramref target%7D.%0A     */%0A    public int binarySearch(int%5B%5D nums, int target) %7B%0A        if (nums == null %7C%7C nums.length == 0) return -1;%0A%0A        int l = 0;%0A        int h = nums.length-1;%0A%0A        while (l %3C= h) %7B%0A            int mid = l + (h-l)/2;%0A%0A            if (nums%5Bmid%5D == target)%0A            %7B%0A                if (mid == 0 %7C%7C nums%5Bmid-1%5D != target) return mid;%0A                else h = mid-1;%0A            %7D%0A            else if (nums%5Bmid%5D %3E target) h = mid-1;%0A            else l = mid+1;%0A        %7D%0A%0A        return h;%0A    %7D%0A%7D

Add binary search implementation