Number n will have only single set bit if it is power of 2. (for eg. 8 in binary 1000)
n - 1 number will have set bit in number 'n' cleared and the all the remaining right bits set. ANDing n and n -1 will result in 0, giving us if number is power of 2 or not.