public class Solution {
public static int reverse(int x) {
int x_cp;
if(x < 0){
x_cp = -x;
}else{
x_cp = x;
}
long result = 0;
while(x_cp !=0 ) {
result = result*10+ x_cp%10;
x_cp /= 10;
}
if(result > 2147483647 || result < -2147483648) return 0;
return x >0 ? (int)result : (int)-result;
}
}
public static int reverse(int x) {
int x_cp;
if(x < 0){
x_cp = -x;
}else{
x_cp = x;
}
long result = 0;
while(x_cp !=0 ) {
result = result*10+ x_cp%10;
x_cp /= 10;
}
if(result > 2147483647 || result < -2147483648) return 0;
return x >0 ? (int)result : (int)-result;
}
}