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);
}
posted @ 2019-05-16 10:29  Jokeyyu  阅读(1273)  评论(0编辑  收藏  举报