67
Java Float intBitsToFloat() method
The intBitsToFloat() method of Java Float class returns the float value in respect to a given bit representation. The argument which passed is considered to be a representation of a floating-point value according to the IEEE 754 floating-point ‘single format’ bit layout.
Syntax:
Parameters:
In this method, bits parameter is passed which is an integer value.
Return Value:
This method returns the floating-point value with the same bit pattern.
- The result returned is positive infinity, if the argument passed is 0X7f800000.
- The result returned is negative infinity, if the argument passed is 0Xff800000.
- The result returned is Nan, if the argument passed is in the range between 0x7f800001 to 0x7fffffff or in the range between 0xff800001 to 0xffffffff.
Example 1
Output:
Float value after conversion = 1.06E-43 Float value after conversion = 6.819E-42 Float value after conversion = NaN
Example 2
Output:
2139095040 value = Infinity 2139095040 value = -Infinity
Example 3
Output:
Enter first integer 567 1. Float value = 7.95E-43 Enter Second integer 67 2. Float value = 9.4E-44
Next TopicJava Float