16进制小数转float

public static void testHexToFloat(String hex) {

Float value = Float.intBitsToFloat(Integer.valueOf(hex), 16));
Log.d(TAG, "testHexToFloat : " + value);

//check a float value
String hexValue = Integer.toHexString(Float.floatToIntBits(0.55f));
Log.d(TAG, "check value \n 0.55 to hex: " + hexValue);
Float floatValue = Float.intBitsToFloat(Integer.valueOf(hexValue, 16));
Log.d(TAG, hexValue + " to float : " + floatValue);
}

转载于:https://www.cnblogs.com/Jokeyyu/p/10874064.html

你可能感兴趣的:(16进制小数转float)