Ok. After doing some testing this algorithm is fast, but considering Big O is upper bound this is not O(log(n+m)). With the perfect data set it takes constant time (in that it runs through the method 1 time). Otherwise it varies wildly depending on input. To be O(log(n+m)) in the case where n.length + m.length == 128 points it should run through a max of 7 times. If we assume m.length < n.length, then depending on the data set it typically runs a max of m+1 times.

For instance:

int[] n = new int[96];
int[] m = new int[32];
int an = 0;
int am = 2;
for(int i = 0; i <n.length; i++){
n[i] = an;
an = an + 3;
}
for(int i = 0; i < m.length; i++){
m[i] = am;
am = am + 3;
}
double[] ans = findMedianSortedArrays(n,m);
for(double i : ans) {
System.out.print(i + " ");
}
public double[] findMedianSortedArrays(int[] A, int[] B) {
int m = A.length;
int n = B.length;
if (m > n) { // to ensure m<=n
int[] temp = A; A = B; B = temp;
int tmp = m; m = n; n = tmp;
}
//added counter
double timesThrough = 0.0;
int iMin = 0, iMax = m, halfLen = (m + n + 1) / 2;
while (iMin <= iMax) {
timesThrough++; //add one each time through
int i = (iMin + iMax) / 2;
int j = halfLen - i;
if (i < iMax && B[j-1] > A[i]){
iMin = iMin + 1; // i is too small
}
else if (i > iMin && A[i-1] > B[j]) {
iMax = iMax - 1; // i is too big
}
else { // i is perfect
int maxLeft = 0;
if (i == 0) { maxLeft = B[j-1]; }
else if (j == 0) { maxLeft = A[i-1]; }
else { maxLeft = Math.max(A[i-1], B[j-1]); }
if ( (m + n) % 2 == 1 ) { return new double[] {maxLeft, timesThrough}; }
int minRight = 0;
if (i == m) { minRight = B[j]; }
else if (j == n) { minRight = A[i]; }
else { minRight = Math.min(B[j], A[i]); }
return new double[] {((maxLeft + minRight) / 2.0), timesThrough};
}
}
return new double[] {0.0, timesThrough}; //returns median and times while loop ran.
}

returns:

95.5 33.0

For a perfect case make the input arrays the same size. It also seems to perform better the closer the arrays get to the same size. I'm sure this might vary more with more creative inputs. I just had to test a bit because O(log(n+m)) had me scratching my head.

Aloha!