Exception in thread "main" java.lang.NumberFormatException: For input string: "64403F "
at java.lang.NumberFormatException.forInputString(Unknown Source)
但它适用于许多输入,如A89B88,927F66,FFDB58。能帮助我理解这里发生的事情吗?
答案 0 :(得分:0)
String
NumberFormatException
将"64403F "
投放到空格trim()
。在解析之前调用String
上的String str = "64403F ";
System.out.println(Integer.parseInt(str.trim(), 16));
。使用Integer.parseInt(String, int)
String str = "64403F ";
System.out.println(Integer.decode("0x" + str.trim()));
6570047
输出
{{1}}