private int binarySearch(int start,int end){
        int mid = (start+end)/2;
        while(start < end){
            mid = (start+end)/2;
            if(f(mid) >0 && f(mid-1) <=0){
                return mid;
            }
            if(f(mid) <=0 && f(mid+1)>0){
                return mid+1;
            }
            if(f(mid) <= 0){
                start = mid+1;
            }else{
                end = mid-1;
            }
        }
        return mid;
    }
http://www.geeksforgeeks.org/find-the-point-where-a-function-becomes-negative/
src/com/interview/binarysearch/MonotonicallyIncreasingFunctionBecomesPositive.java