private static String getByteBinaryStringForFloat(float f) {
        String signBit = "0";
        if (f < 0) {
            signBit = "1";
            f = -f;
        }
        int integerPart = (int) f;

        float fractionalPart = f - integerPart;
        fractionalPart *= 16;

        float tmp = fractionalPart;
        int factor = 16;
        int count = 0;
        while ((tmp - (int) tmp > 0) && (count < 4)) {
            factor = factor * 2;
            tmp = (f - integerPart) * factor;
            count++;
        }
        String fractionalBits = Integer.toBinaryString((int) tmp);
        count = count + 4 - fractionalBits.length();
        while (count > 4) {
            fractionalBits = "0" + fractionalBits;
            count--;
        }
        int moveLeft = -count;
        String integerBits = integerPart == 0 ? "" : Integer.toBinaryString(integerPart);
        String exp = integerBits.length() == 0 ? toExcessThreeValue(moveLeft) : toExcessThreeValue(integerBits.length());
        String result = signBit + exp + integerBits + fractionalBits;
        while (result.length() < 8) {
            result = result + "0";
        }
        return result.substring(0, 8);
    }