bit operation to generate Gray Code