Reverse Integer

来源:互联网 发布:js获取被选中的radio 编辑:程序博客网 时间:2024/05/17 00:50
public class Solution {    public int reverse(int x) {        long result = 0;        while(x != 0) {            result = 10 * result + x % 10;            x /= 10;        }        return result < Integer.MIN_VALUE || result > Integer.MAX_VALUE ? 0 : (int) result;    }}
0 0