@@ -0,0 +1,568 @@
+%0Apackage hd;%0A%0Aimport java.util.Arrays;%0A%0Aclass Solution %7B%0A  public int hammingDistance(int x, int y) %7B%0A    int ret = 0;%0A    // %E6%9F%A5%E6%89%BE%E4%B8%8D%E5%90%8C%E7%9A%84%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%BD%8D%0A    int diff = x %5E y;%0A%0A    while (diff %3E 0) %7B%0A      // %E9%80%9A%E8%BF%87%E6%8C%89%E4%BD%8D%E4%B8%8E, %E6%9D%A5%E5%88%A4%E6%96%AD%E6%9C%80%E4%BD%8E%E4%BD%8D%E6%98%AF%E5%90%A6%E4%B8%BA 1. %E4%B8%BA 1 %E5%88%99%E7%BB%93%E6%9E%9C+1%0A      int bit = diff & 1;%0A      if(bit %3E 0) %7B%0A        ret = ret + 1;%0A      %7D%0A      // %E5%8F%B3%E7%A7%BB, %E6%9C%80%E9%AB%98%E4%BD%8D%E8%A1%A5%E9%9B%B6.%0A      diff = diff %3E%3E 1;%0A    %7D%0A    return ret;%0A  %7D%0A%7D%0A%0A/**%0A * Answer%0A */%0Apublic class Answer %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A%0A    Solution sol = new Solution();%0A    int ret = sol.hammingDistance(1, 4);%0A%0A    System.out.println(ret);%0A  %7D%0A%7D%0A

add hamming distance solution