public class Solution { public int reverse(int x) { StringBuffer s; String xs = java.lang.Math.abs(x) + ""; s = new StringBuffer(xs); int a; if(x>0){ a = Integer.parseInt(s.reverse().toString()); }else{ a = Integer.parseInt(("-"+s.reverse()).toString()); } return a; } }
__YXQ__
相关分类