Can anyone tell me the best way to check the number of bits in a number ? for ex, in 2 set bits are1 , in 3 it is 2. So what is best way today available so as to get that value ? thanks. just give me link of algo, i wana code it myself. Give me hint or algo's link. thanks in advance.