Float floatToIntBits() method in Java with examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The floatToIntBits() method in Float Class is a built-in function in java that returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout. Syntax: public static int floatToIntBits(float val) Parameter: The method accepts only one parameter val which specifies a floating-point number to be converted into integer bits. Return Values: The function returns the integer bits that represent the floating-point number. Below are the special cases: If the argument is positive infinity, the result is 0x7f800000. If the argument is negative infinity, the result is 0xff800000. If the argument is NaN, the result is 0x7fc00000. Below programs illustrates the use of Float.floatToIntBits() method: Program 1: java // Java program to demonstrate // Float.floatToIntBits() method import java.lang.*; class Gfg1 { public static void main(String args[]) { float val = 1.5f; // function call int answer = Float.floatToIntBits(val); // print System.out.println(val + " in int bits: " + answer); } } Output: 1.5 in int bits: 1069547520 Program 2: Java // Java program to demonstrate // Float.floatToIntBits() method import java.lang.*; class Gfg1 { public static void main(String args[]) { float val = Float.POSITIVE_INFINITY; float val1 = Float.NEGATIVE_INFINITY; float val2 = Float.NaN; // function call int answer = Float.floatToIntBits(val); // print System.out.println(val + " in int bits: " + answer); // function call answer = Float.floatToIntBits(val1); // print System.out.println(val1 + " in int bits: " + answer); // function call answer = Float.floatToIntBits(val); // print System.out.println(val2 + " in int bits: " + answer); } } Output: Infinity in int bits: 2139095040 -Infinity in int bits: -8388608 NaN in int bits: 2139095040 Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#floatToIntBits(float) Comment More infoAdvertise with us Next Article FloatBuffer get() methods in Java with Examples G gopaldave Follow Improve Article Tags : Java java-basics Java-lang package Java-Functions Java-Float +1 More Practice Tags : Java Similar Reads Float floatToRawIntBits() method in Java with examples The floatToRawIntBits() method in Float Class is a built-in function in java that returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values. Syntax: public static int floatToRawIntBits(floa 2 min read Float intValue() method in Java with examples The intValue() method in Float Class is a built in method in Java that returns the value specified by the calling object as int after type casting. Syntax: public int intValue() Parameters: The function accepts no parameter. Return Value: It return the value of FloatObject as int. Below programs ill 2 min read FloatBuffer get() methods in Java with Examples get() The get() method of java.nio.FloatBuffer Class is used to reads the float at the given buffer's current position, and then increments the position. Syntax : public abstract float get() Return Value: This method returns the float value at the buffer's current position. Throws: This method throw 5 min read Float floatValue() in Java with examples The floatValue() method in Float Class is a built-in function in java that returns the value specified by the calling object as float after type casting. Syntax: public float floatValue() Return Value: It returns the value of FloatObject as float. Below programs illustrate floatValue() method in Jav 2 min read Byte floatValue() method in Java with examples The floatValue() method of Byte class is a built in method in Java which is used to return the value of this Byte object as float. Syntax ByteObject.floatValue() Return Value: It return the value of ByteObject as float. Below is the implementation of floatValue() method in Java: Example 1: Java // J 2 min read Java floor() method with Examples The java.lang.Math.floor() returns the double value that is less than or equal to the argument and is equal to the nearest mathematical integer. Note: If the argument is Integer, then the result is Integer.If the argument is NaN or an infinity or positive zero or negative zero, then the result is th 2 min read Like