Float floatToRawIntBits() method in Java with examples Last Updated : 26 Oct, 2018 Comments Improve Suggest changes Like Article Like Report 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(float val) Parameter: The method accepts only one parameter val which specifies a floating-point number. Return Values: The function returns the bits that represent the floating-point number. However there are 3 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.floatToRawIntBits() method: Program 1: java // Java program to demonstrate // Float.floatToRawIntBits() method import java.lang.*; class Gfg1 { public static void main(String args[]) { float val = 1.5f; // function call int answer = Float.floatToRawIntBits(val); // print System.out.println(val + " in raw int bits: " + answer); } } Output: 1.5 in raw int bits: 1069547520 Program 2: Java // Java program to demonstrate // Float.floatToRawIntBits() 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.floatToRawIntBits(val); // print System.out.println(val + " in raw int bits: " + answer); // function call answer = Float.floatToRawIntBits(val1); // print System.out.println(val1 + " in raw int bits: " + answer); // function call answer = Float.floatToRawIntBits(val); // print System.out.println(val2 + " in raw int bits: " + answer); } } Output: Infinity in raw int bits: 2139095040 -Infinity in raw int bits: -8388608 NaN in raw int bits: 2139095040 Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#floatToRawIntBits(float) Comment More infoAdvertise with us Next Article Float floatToRawIntBits() method in Java with examples gopaldave Follow Improve Article Tags : Java java-basics Java-lang package Java-Functions Java-Float +1 More Practice Tags : Java Similar Reads Float floatToIntBits() method in Java with examples 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 on 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 flip() methods in Java with Examples The flip() method of java.nio.FloatBuffer Class is used to flip this buffer. By flipping this buffer, it meant that the buffer will be trimmed to the current position and then the position will be changed to zero. During this process, if any mark is there on the buffer, then that mark will be automa 2 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 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 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 FloatBuffer put() methods in Java with Examples put(float f) The put(float f) method of java.nio.FloatBuffer Class is used to write the given float into the newly created float buffer at the current position, and then increments the position. Syntax : public abstract FloatBuffer put(float f) Parameters: This method takes the float value f as a pa 6 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 UUID getLeastSignificantBits() Method in Java with Examples The UUIDs are 128-bit values. The getLeastSignificantBits() Method of UUID class in Java is used to get the least significant 64 bits of this UUID. Syntax: public long getLeastSignificantBits() Parameters: The method does not take any parameters. Return Value: The method returns an integer value whi 2 min read Float compare() Method in Java with Examples The compare() method of Float Class is a built-in method in Java that compares the two specified float values. The sign of the integer value returned is the same as that of the integer that would be returned by the function call. Syntax: public static int compare(float f1, float f2)Parameters: The f 2 min read Like