我有:
int number = 0x00000024;
Run Code Online (Sandbox Code Playgroud)
它没有问题,但现在我用de格式得到它:
<MAN>
<NAME hexa="0x00000001"/>
</MAN>
Run Code Online (Sandbox Code Playgroud)
我尝试用以下方法解析hexa:
Integer.parseInt(parser.getAttributeValue(0), 16)
Run Code Online (Sandbox Code Playgroud)
但它说:
Unable to parse '0x00000001' as integer
Run Code Online (Sandbox Code Playgroud)
谁知道发生了什么事?
删除0x:
Integer.parseInt(parser.getAttributeValue(0).substring(2), 16)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
818 次 |
| 最近记录: |