@@ -0,0 +1,624 @@
+package leetcode1_10;%0A%0A/**Reverse digits of an integer.%0A Example1: x = 123, return 321%0A Example2: x = -123, return -321%0A * Created by eugene on 16/4/20.%0A */%0Apublic class ReverseInteger %7B%0A%0A    public int reverse(int x) %7B%0A        if (x==0 %7C%7C x==Integer.MIN_VALUE) return 0; //TODO Integer.MIN_VALUE%E6%97%B6%E4%B9%9F%E8%BF%94%E5%9B%9E0%0A        int n = x;%0A        if (x%3C0) n = -n;%0A        StringBuilder s = new StringBuilder(String.valueOf(n)).reverse();%0A        int i = 0;%0A        while (s.charAt(i)=='0') i++;%0A        long l = Long.valueOf(s.substring(i));%0A        if (l%3EInteger.MAX_VALUE) return 0;%0A        if (x%3C0) l = -l;%0A        return (int)l;%0A    %7D%0A%0A%7D%0A

Reverse Integer