public static double findNthSortedArrays(int A[], int B[], int nth) {
		int alen = A.length;
		int blen = B.length;
		int i = 0, j = 0;
		while (i < alen && j < blen) {
			if (1 == nth) {
				return min(A[i], B[j]);
			}
			int nth1 = nth / 2;
			int nth2 = nth - nth1;
			nth1 = min(nth1, alen - i);
			nth2 = min(nth2, blen - j);
			if (A[i + nth1 - 1] > B[j + nth2 - 1] ) {
				nth = nth - nth2;
				j = j + nth2;
			} else {
				nth = nth - nth1;
				i = i + nth1;
			}
		}
		if (i == alen) {
			return B[j + nth - 1];
		} else {
			return A[i + nth - 1];
		}
	}