Float isInfinite() method in Java with examples Last Updated : 13 Sep, 2021 Comments Improve Suggest changes Like Article Like Report The isInfinite() method in Float Class is a built in method in Java returns true if this Float value or the specifies float value is infinitely large in magnitude, false otherwise.Syntax: public boolean isInfinite() or public static boolean isInfinite(float val) Parameters: The function accepts a single parameter val which specifies the value to be checked when called directly with the Float class as static method. The parameter is not required when the method is used as instance method. Return Value: It return true if the val is infinite else it return false.Below programs illustrate isInfinite() method in Java:Program 1: Using static isFinity() method Java // Java code to demonstrate // Float isInfinite() method // without parameter class GFG { public static void main(String[] args) { // first example Float f1 = new Float(1.0 / 0.0); boolean res = f1.isInfinite(); // printing the output if (res) System.out.println(f1 + " is infinity"); else System.out.println(f1 + " is not infinity"); // second example f1 = new Float(0.0 / 0.0); res = f1.isInfinite(); // printing the output if (res) System.out.println(f1 + " is infinity"); else System.out.println(f1 + " is not infinity"); } } Output: Infinity is infinity NaN is not infinity Program 2: Using non-static isFinity() method Java // Java code to demonstrate // Float isInfinite() method // with parameter class GFG { public static void main(String[] args) { // first example Float f1 = new Float(1.0 / 0.0); boolean res = f1.isInfinite(f1); // printing the output if (res) System.out.println(f1 + " is infinity"); else System.out.println(f1 + " is not infinity"); // second example f1 = new Float(0.0 / 0.0); res = f1.isInfinite(f1); // printing the output if (res) System.out.println(f1 + " is infinity"); else System.out.println(f1 + " is not infinity"); } } Output: Infinity is infinity NaN is not infinity Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#isInfinite() Comment More infoAdvertise with us Next Article Float isInfinite() 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 isNaN() method in Java with examples The Float.isNaN() method in Float Class is a built in method in Java returns true if this Float value or the specified float value is Not-a-Number (NaN), or false otherwise. Syntax: public boolean isNaN() or public static boolean isNaN(float val) Parameters: he function accepts a single parameter va 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 Double isInfinite() method in Java with examples The java.lang.Double.isInfinite() method of Java Double class is a built in method in Java returns true if this Double value or the specified double value is infinitely large in magnitude, false otherwise. Syntax: public boolean isInfinite() or public static boolean isInfinite(double val) Parameters 2 min read 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 hashCode() method in Java with examples The hashCode() method method in Float Class is a built-in method in Java that return the hashcode value of this Float object. Syntax: public int hashCode() Parameters: It takes no parameters. Returns: The function returns a hash code value for this object. Below is the implementation of hashCode() m 1 min read Float equals() method in Java with examples The equals() method in Float Class is a built-in function in java that compares this object to the specified object. The result is true if and only if the argument is not null and is a Float object that contains the same double value as this object. It returns false if both the objects are not same. 3 min read Field getInt() method in Java with Examples The getInt() method of java.lang.reflect.Field used to get the value of int which has to be static or instance field type. This method also used to get the value of another primitive type convertible to type int via a widening conversion. When a class contains a static or instance int field and we w 3 min read 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 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 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 Like