汉明距离计算,非字符串

public int hammingDistance(int x, int y) {
int hamming = x ^ y;
int cnt = 0;
while(hamming > 0){
hamming = hamming & (hamming - 1);
cnt++;
}
return cnt;
}

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:申请域名网站空间、营销软件、网站建设、嵩明网站维护、网站推广。

char[] strChars = str.toCharArray();
char[] targetChars = target.toCharArray();
int count = 0;
for (int i = 0; i < 1280; i++) {
if (strChars[i] == targetChars[i]) {
count++;
}
}
return 1280-count;


网页标题:汉明距离计算,非字符串
网站网址:http://ybzwz.com/article/pdhcep.html