Integer.parseInt("ff8ca87c", 16);
這給了我一個NumberFormatException出於某種原因。你知道這是爲什麼嗎?爲什麼此Java parseInt十六進制字符串導致NumberFormatException?
Exception in thread "main" java.lang.NumberFormatException: For input string: "ff8ca87c"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.valueOf(Unknown Source)
你試過0xff8ca87c了嗎? – John3136 2012-02-08 09:33:38
@ John3136是的,它也不起作用 – Ignoreme 2012-02-08 09:34:34
@ John3136 - 該規範根本沒有提到「0x」前綴。 – Polynomial 2012-02-08 09:34:58