把数字当成字符串来处理:

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        if(sb.charAt(0) == '-'){
            sb.deleteCharAt(0);
            sb = sb.reverse();//字符串自带逆序方法
            sb.insert(0, '-');
            System.out.println(sb);
        }else System.out.println(sb.reverse());
    }
}