public class Test {
public int reverse(int x) {
long n = 0;
while(x != 0) {
n = n*10 + x%10;
x = x/10;
}//超过Int最大值,会按最大值取## 数字翻转
return (int)n==n? (int)n:0;
}
}
数字翻转
最新推荐文章于 2024-03-31 18:25:00 发布
public class Test {
public int reverse(int x) {
long n = 0;
while(x != 0) {
n = n*10 + x%10;
x = x/10;
}//超过Int最大值,会按最大值取## 数字翻转
return (int)n==n? (int)n:0;
}
}