public int reverse(int num) { if (num < 10) { return num; } else {
int rev=num%10 * (int) Math.pow(10, (int) Math.log10(num)); return rev+ reverse(num / 10);
} }
------ OR --------
public int reverse(int num) {
retrun (num < 10)? num:num%10 * (int) Math.pow(10, (int) Math.log10(num))
+reverse(num / 10);
} }