标签:eve leetcode res class rev tco code etc while
public int reverse(int x) {
long res = 0;
while (x != 0){
res = res* 10 + x % 10;
x /= 10;
}
if(res >= Integer.MAX_VALUE || res < Integer.MIN_VALUE)
return 0;
return (int)res;
}
leetcode 7. Reverse Integer [java]
标签:eve leetcode res class rev tco code etc while
原文地址:https://www.cnblogs.com/whyaza/p/10661942.html