怎么判断一个数的二进制是不是回文数# JobHunting - 待字闺中
s*d
1 楼
可以像这样通过以为来做吗?还是%10比较好,还有其他什么更好的方法吗?
public static boolean judgepalidrom(int num){
char[] ch=new char[Integer.size];
for(int i=0;i char[Integer.size-i-1]=(char)((num>>i)&1+'0');
}
String str=new String(ch);
for(int j=0;j if(str[j]!=str[str.length()-j-1])
return false;
}
return true;
}
public static boolean judgepalidrom(int num){
char[] ch=new char[Integer.size];
for(int i=0;i
}
String str=new String(ch);
for(int j=0;j
return false;
}
return true;
}