I am an optimistic and hard worker Software engineer always looking forward to expand my knowledge and experience in the field, and go forward in my career.
“It is wrong always, everywhere, and for anyone, to believe anything upon insufficient evidence.”
number of bits = floor(log(number)/ log(2))+1
Conclusion: number of set bits in a number: number = number & (number-1), till number != 0 and increment the counter at each step. Finally return the counter.