Here you can find the source of toFloat(int hbits)
public static float toFloat(int hbits)
//package com.java2s; //License from project: Apache License public class Main { public static float toFloat(int hbits) { int mant = hbits & 0x03ff; // 10 bits mantissa int exp = hbits & 0x7c00; // 5 bits exponent if (exp == 0x7c00) // NaN/Inf exp = 0x3fc00; // -> NaN/Inf else if (exp != 0) // normalized value {//from w w w . jav a2 s . c o m exp += 0x1c000; // exp - 15 + 127 if (mant == 0 && exp > 0x1c400) // smooth transition return Float.intBitsToFloat((hbits & 0x8000) << 16 | exp << 13 | 0x3ff); } else if (mant != 0) // && exp==0 -> subnormal { exp = 0x1c400; // make it normal do { mant <<= 1; // mantissa * 2 exp -= 0x400; // decrease exp by 1 } while ((mant & 0x400) == 0); // while not normal mant &= 0x3ff; // discard subnormal bit } // else +/-0 -> +/-0 return Float.intBitsToFloat( // combine all parts (hbits & 0x8000) << 16 // sign << ( 31 - 15 ) | (exp | mant) << 13); // value << ( 23 - 10 ) } }