Java (OpenJDK 8), 104 bytes
n->{int N=0,i=8,I=1,x;for(;I<n.highestOneBit(n>>7);N=x>N?x:N,I<<=1)x=(I-1&n)|((~0<<i++&n)>>8);return N;}
Olivier Grégoire
- 14.5k
- 3
- 33
- 56
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchangen->{int N=0,i=8,I=1,x;for(;I<n.highestOneBit(n>>7);N=x>N?x:N,I<<=1)x=(I-1&n)|((~0<<i++&n)>>8);return N;}