public int search(int[] A, int target) {   
        int start = 0, end = A.length - 1;
        while(start + 1 < end){
            int mid = start + (end - start)/2;
            if(A[mid] == target){
                return mid;
            }
            if(A[mid] < target){
                start = mid;
            }else{
                end = mid;
            }
        }
        
        if(A[start] == target){
            return start;
        }
        
        if(A[end] == target){
            return end;
        }
        
        return -1;   
}
