Suppose, you are given an integer number. You have to tell how many set bits are there in the number.

If we know bit operations, it is easy to get the count. First, I am explaining how to get this using bitwise AND operations.

Continue reading “Getting the number of set bits in a number using Java”