其实我一开始是想用StringBuilder里的reverse()来做的。。。

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int tmp = 0;
        do{
            tmp = num % 10;
            num = num / 10;
            System.out.print(tmp);
        }while(num != 0);
    }
}