Java Float floatToIntBits() methodThe floatToIntBits() method of Float class returns the specified floating-point value according to the IEEE 754 floating-point 'single format' bit layout. Syntax:Parameters:A float type parameter (value) is passed where value is a floating-point number. Return Value:The floatToIntBits(float value) method of Float class returns the bits of the given floating-point number.
Example 1Test it NowOutput: Equivalent integer bits = 1116169830 Example 2Test it NowOutput: 67.5 value in int Bits = 1116143616 Infinity value in int Bits = 2139095040 NaN value in int Bits = 2143289344 -Infinity value in int Bits = -8388608 Example 3Test it NowOutput: Error:(12, 23) java: cannot find symbol symbol: method floatToIntBits(java.lang.Float) location: variable obj1 of type com.interf.Float_floatToIntBitsMethod_Example2 The floatToIntBits() is a static method of Float class so, it will always be called with Float class name otherwise, it will give an error like above.
Next TopicJava Float
|