public int reserveInt2(int x){
long a = 0;
while (x != 0 ){
a =a*10 + x%10;
x /= 10;
}
if((a>Integer.MAX_VALUE)||(a<Integer.MIN_VALUE)) {
return 0;
}
return (int) a;
}
反转32位有符号整数
最新推荐文章于 2023-02-11 10:41:03 发布