public int searchInsert2(int[] A, int target) {
		if(A == null){
			return 0;
		}
		int res = 0;
		if(target < A[0]){
			return 0;
		}
		if(target > A[A.length - 1]){
			res = A.length;
		}
		for (int i = 0; i < A.length; i++) {
			if(target == A[i]){
				res = i;
			}
			if(i != A.length -1){
				if((target > A[i])&&(target<A[i+1])){
					res = i+1;
				}
			}
		}
		return res;
    }