写出一个程序,接受一个十六进制的数,输出该数值的十进制表示。(多组同时输入 )
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { String hex_num = in.nextLine(); hex_num = hex_num.replace("0x", ""); long l = Long.parseLong(hex_num, 16); System.out.println(l); } } }
原文:https://www.cnblogs.com/fly1024/p/12577779.html