class Solution {
public static int convertInteger(int A, int B) {
String sa=Integer.toBinaryString(A);
String sb=Integer.toBinaryString(B);
while (sa.length()<32) {
StringBuffer stra = new StringBuffer();
stra.append("0").append(sa);
sa = stra.toString();
}
while (sb.length()<32) {
StringBuffer strb = new StringBuffer();
strb.append("0").append(sb);
sb = strb.toString();
}
char[] anum=sa.toCharArray();
char[] bnum=sb.toCharArray();
int ans=0;
for(int i=0;i<32;i++)
{
if(anum[i]!=bnum[i])ans++;
}
return ans;
}
}
不看视频能学会Java嘛 害 简单题都得查着写