public int swapTensAndUnits(int n) { int tens = (n/10)%10; int units = n%10; int rest = n-n%100; return rest+units*10+tens; }