Can someone please help me solve this? The number should be variable and not constant. The output should be:
Timestamping In 6 Digit 8 5 6 3 0 1 Average In 6 Digit
What do you really want to do? Print two integer numbers reversed? Then you should say so.
public static String reverseDigits(int i) {
StringBuilder sb = new StringBuilder();
sb.append(i);
sb.reverse();
return sb.toString();
}
...
System.out.println(reverseDigits(1234567));
...
If you just want to reverse a number then here you go
public String reverseNum(Integer i)
{
return new StringBuilder(i.toString()).reverse();
}