```
class Solution {
public int hammingDistance(int x, int y) {
int firtNumPosition = 0, secondNumPosition = 0;
for(int i = 0; (1 << i) <= x || (1 << i) <= y; i++) { //i is the position of the bit
if((1 << i) == x)
firtNumPosition = i;
if((1 << i) == y )
secondNumPosition = i;
}
return (secondNumPosition - firtNumPosition);
}
}
```