public int searchInsert(int[] A, int target) {
        if(A == null || A.length == 0) return 0;
        int s = 0, e = A.length - 1, m;
        while(s <= e){
            m = s + (e - s) / 2;
            if(A[m] == target) return m;
            else if(A[m] < target) s = m+1;
            else e = m-1;
        }
        return s;
    }