public int binarysearch(int[] A, int start, int end, int target) {

		if (start >= end && target != A[start]) {
			// special case
			if (target < A[start])
				return start;
			return start + 1;
		}
		int mid = (start + end) / 2;
		if (A[mid] == target)
			return mid;
		if (target < A[mid])
			return binarysearch(A, start, mid, target);
		else
			return binarysearch(A, mid + 1, end, target);

	}