Reversing a number using String and StringBuffer

class ReverseNumber2 {
    public static void main(String[] args) {
        StringBuffer number = new StringBuffer(args[0]);
        int num = Integer.parseInt(number.reverse().toString());
        System.out.println(num);
    }
}

Comments

Popular posts from this blog

Zeller's Congruence

Property Event-Delegation

Method with variable arguments