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;
}
}
添加回答
举报
0/150
提交
取消