Number of right cyclic shifts to give the biggest number
Your solution seems fine.
I would suggest some coding style improvements though:


To avoid errors, avoid magic numbers, put them in constants, for example:

MAX_N = 0x3fffffff
MAX_SHIFT = 30

The variable m doesn't need to be initialized before the loop. In fact, it doesn't need to be declared before the loop. Move it inside.
res is not a great name to store the number of shifts to get the highest number. shiftCount would be better.
solution is not a great name for the method to get the shift count for the highest number. getShiftCountToHighestNum would be better.


With the above suggestions applied, the code becomes:

private static final int MAX_N = 0x3fffffff;
private static final int MAX_SHIFT = Integer.toBinaryString(MAX_N).length();

public int getShiftCountToHighestNum(int N) {
    long max = N;
    int shiftCount = 0;
    for (int i = 1; i &lt; MAX_SHIFT; i++) {
        long m = (N &gt;&gt;&gt; i) &amp; MAX_N | (N &lt;&lt; (MAX_SHIFT - i) &amp; MAX_N);
        if (m &gt; max) {
            max = m;
            shiftCount = i;
        }
    }
    return shiftCount;
}


As for the time complexity,
I believe this is indeed \$O(\log N)\$.
The number of calculation steps is proportional to the number of bits in \$N\$, which grows much slower than \$N\$ itself.