public int search(int[] A, int target) {
			int low = 0;
			int high = A.length - 1;

			while (low <= high) {
				int index = (low + high) / 2;
				if (target == A[index])
					return index;
				if (A[low] <= A[high]) {
					if (target > A[index]) {
						low = index + 1;
					} else {
						high = index;
					}
				} else {
					if (A[index] >= A[low]) {
						if (target > A[index]) {
							low = index + 1;
						} else if (target < A[low]) {
							low = index + 1;
						} else {
							high = index;
						}
					} else {
						if (target < A[index]) {
							high = index;
						} else if (target <= A[high]) {
							low = index + 1;
						} else {
							high = index;
						}
					}
				}
			}

			return -1;
		}