Double isInfinite() method in Java with examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: The function accepts a single parameter val which specifies the value to be checked when called directly with the Double 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: Java // Java code to demonstrate // Double isInfinite() method // without parameter class GFG { public static void main(String[] args) { // first example Double f1 = new Double(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 Double(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: Java // Java code to demonstrate // Double isInfinite() method // with parameter class GFG { public static void main(String[] args) { // first example Double f1 = new Double(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 Double(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/Double.html#isInfinite(double) Comment More infoAdvertise with us Next Article Double isNaN() method in Java with examples G gopaldave Follow Improve Article Tags : Java java-basics Java-lang package Java-Functions Java-Double +1 More Practice Tags : Java Similar Reads Double isNaN() method in Java with examples The isNaN() method of Java Double class is a built in method in Java returns true if this Double value or the specified double value is Not-a-Number (NaN), or false otherwise. Syntax: public boolean isNaN() or public static boolean isNaN(double val) Parameters: The function accepts a single paramete 2 min read Double intValue() method in Java with examples The intValue() method of Double class is a built in method to return the value specified by the calling object as int after type casting. Syntax: DoubleObject.intValue() Return Value: It return the value of DoubleObject as int. Below programs illustrate intValue() method in Java: Program 1: Java // 2 min read Float isInfinite() method in Java with examples 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 si 2 min read DoubleAdder intValue() method in Java with Examples The java.DoubleAdder.intValue() is an inbuilt method in java that returns the sum() as an int after a narrowing primitive conversion. When the object of the class is created its initial value is zero. Syntax: public int intValue() Parameters: This method does not accepts any parameter. Return Value: 1 min read Double compare() Method in Java with Examples The compare() method of Double Class is a built-in method in Java that compares the two specified double 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(double d1, double d2) Parameters: 2 min read DoubleAccumulator intValue() method in Java with Examples The Java.DoubleAccumulator.intValue() is an inbuilt method in java that returns the current value as an int after a narrowing primitive conversion. The initial datatype is double which is explicitly converted into type int without accepting any parameters. Syntax: public int intValue() Parameters: T 2 min read Like