Find maximum in sorted and rotated array This is an interview question.
A sorted rotated array is a sorted array which was rotated 0 or more times.

For example: [1,2,3] -&gt; [2,3,1]                  

Please tell me what do you think about the following (correctness, efficiency, coding conventions) and specifically if I can remove in some way the special handle for array of two elements:              

static int findMax(int arr[]) { 
    return findMax(arr, 0 , arr.length - 1); 
} 

static int findMax(int arr[], int low, int high) {
    int middle;

    if (low == high) {
        return arr[low];
    }
    if ( Math.abs(high - low) == 1 ) {
        return Math.max(arr[low], arr[high]);
    }

    middle = (low + high) &gt;&gt; 1;
    if (arr[middle] &gt; arr[middle + 1]) {
        return arr[middle];
    }
    if (arr[low] &gt; arr[middle]) {
        return findMax(arr, low, middle - 1);
    }
    return findMax(arr, middle + 1, high);
}
Math.abs in Math.abs(high - low) == 1 is suspicious. high should always be not less than low. Remove it.
middle = (low + high) &gt;&gt; 1 may (and will) overflow. Do middle = low + (high - low) &gt;&gt; 1.

That said, &gt;&gt; 1 is no better than) / 2.
Java is notorious in not eliminating the tail recursion. You should do it manually. First, rewrite it in a tail-recursive form:

    if (low == high) {
        return arr[low];
    }
    if ( Math.abs(high - low) == 1 ) {
        return Math.max(arr[low], arr[high]);
    }

    middle = (low + high) &gt;&gt; 1;
    if (arr[middle] &gt; arr[middle + 1]) {
        return arr[middle];
    }
    if (arr[low] &gt; arr[middle]) {
        high = middle - 1;
    } else {
        low = middle + 1;
    }
    return findMax(arr, low, high);


then eliminate a recursive call:

    while (high - low &gt; 2) {
        middle = low + (high - low) / 2;
        if (arr[middle] &gt; arr[middle + 1]) {
            return arr[middle];
        }
        if (arr[low] &gt; arr[middle]) {
            high = middle - 1;
        } else {
            low = middle + 1;
        }
    }
    return Math.max(arr[low], arr[high]);