Same as always:
return (num & (num - 1)) == 0 && (num & 0x55555555) != 0;
but the hex literal can be replaced with
0b01010101_01010101_01010101_01010101 since Java 7.
I think it shows the intention more than the hex literal.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.