System.out.println(Integer.parseInt("4B5CE3D77A73",16);
Run Code Online (Sandbox Code Playgroud)
抛出一个数字格式异常.并且mac地址是从该站点生成的有效地址http://www.miniwebtool.com/mac-address-generator/
我在这里想念一下吗?
看起来这个数字大于Integer可以容纳的数字.试试Long:
Long.parseLong("4B5CE3D77A73",16)
Run Code Online (Sandbox Code Playgroud)
文档说它会抛出NumberFormatException - if the string does not contain a parsable integer.不仅如果字符串包含无效字符,而且如果数字大于Integer.MAX_VALUE.
| 归档时间: |
|
| 查看次数: |
5103 次 |
| 最近记录: |