调用API的做法:

我寻思着手撸进制转换和调用API也没啥太大区别啊,为啥不用简单的方法

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        StringBuilder sb = new StringBuilder(str);
        str = sb.delete(0,2).toString();
        int num = Integer.parseInt(str,16);
        System.out.println(num);
    }
}