1)使用BigInteger与16进制之间的转化
// 16进制转大数值
new BigInteger("419e6666", 16);
2) 使用 Float.intBitsToFloat() 方法
//参数为 int 类型的二进制、八进制、十六进制
Float.intBitsToFloat(1100899942)
该方法支持带符号转换,示例代码及运行效果:
Float f = Float.intBitsToFloat(new BigInteger("419e6666", 16).intValue());
System.out.println(f);
419e6666十六进制字符串转浮点数结果为:19.8
版权声明:本文为qq_40042416原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。