public int reverseDigit(int num){
if(num==0) return 0;
int flag = num<0?-1:1;
num = Math.abs(num);
int res = 0 ;
int temp = num;
while(temp!=0){
int cur = temp%10;
res = res*10+cur;
temp = temp/10;
}
return flag*res;
}