"""

class Solution {

public int reverse(int x) {

if(x==0)

return 0;

boolean neg = (x<0)?true:false;

if(neg)

x = x*-1;

int rev = 0;

while(x>0) {

if(rev > 0 && Integer.MAX_VALUE/rev < 10)

return 0;

rev = (rev*10) + (x%10);
x = x/10;
}
if(neg)
rev = rev*-1;

return rev;

}

}

"""