import java.util.*;
public class Solution {
/**
*
* @param x int整型
* @return int整型
*/
public int reverse (int x) {
// write code here
long res = 0;
while (x != 0) {
res *= 10;
res += x %10;
x /= 10;
}
return res > Math.pow(2, 31) - 1 || res < -Math.pow(2, 31) ? 0 : (int) res;
}
}
京公网安备 11010502036488号