public double findMedianSortedArrays(int A[], int B[]) {
        int m = A.length;
        int n = B.length;

        if ((m + n) % 2 != 0) // odd
            return (double) getMedian(A, 0, m - 1, B, 0, n - 1, (m + n) / 2);
        else { // even
            return (getMedian(A, 0, m - 1, B, 0, n - 1, (m + n) / 2) + getMedian(
                    A, 0, m - 1, B, 0, n - 1, (m + n) / 2 - 1)) * 0.5;
        }
    }