You can use bitwise operators. In this case use AND (&) operator. For instance decimal & 0x01 returns a value related to 1st bit , decimal & 0x02 returns a value related to 2nd, decimal & 0x04 returns a value related to 3rd bit and so on. If the returned value is 0 it means that the corresponding bit value is 0, and if the returned value is not 0 then the corresponding bit value is 1