Infineon Technologies interview question

Write code to find no of set bits in an integer.