public int binarySearch(int[] A, int target, int start, int end) {
        if(A[start] > target || A[end] < target) return -1;
        while(start <= end) {
            int mid = (end - start) / 2 + start;
            if(A[mid] == target) return mid;
            else if(A[mid] < target) start = mid + 1;
            else end = mid - 1;
        }
        return -1;
    }