int hammingDistance(int x, int y){ x = x^y; int num=0; while(x){ num += x & 1; x >>=1; } return num; }