16进制字符串转int问题,当超出了int范围Integer.parseInt("c28d2807",16) 就会报NumberFormatException
使用BigInteger b = new BigInteger("c28d2807", 16);转换即可,然后可以得到需要的int(负值)或者long值
转自:https://www.cnblogs.com/rvs-2016/p/8191285.html
侵权请联系。
当16进制字符串转换为int时遇到超出范围的异常,可以使用BigInteger来解决。例如:BigInteger b = new BigInteger(c28d2807 16); 这样可以安全地转换为int或long值,避免NumberFormatException。
16进制字符串转int问题,当超出了int范围Integer.parseInt("c28d2807",16) 就会报NumberFormatException
使用BigInteger b = new BigInteger("c28d2807", 16);转换即可,然后可以得到需要的int(负值)或者long值
转自:https://www.cnblogs.com/rvs-2016/p/8191285.html
侵权请联系。

被折叠的 条评论
为什么被折叠?