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

		return -1;
	}