Is a double value an infinite large value, or it is not a number.

isInfinite( ) returns true if the value being tested is infinitely large or small in magnitude. isNaN( ) returns true if the value being tested is not a number.

boolean isInfinite()
Returns true if this Double value is infinitely large in magnitude, false otherwise.
static boolean isInfinite(double v)
Returns true if the specified number is infinitely large in magnitude, false otherwise.
boolean isNaN()
Returns true if this Double value is a Not-a-Number (NaN), false otherwise.
static boolean isNaN(double v)
Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

public class Main {
  public static void main(String[] args) {
    Double double1 = new Double(1/0.0);
    

    System.out.println(double1.isInfinite());

  }
}

The output:


true

public class Main {
  public static void main(String[] args) {
    Double double1 = new Double(0.0/0.0);
    
    System.out.println(Double.isNaN(double1));
    System.out.println(double1.isNaN());

  }
}

The output:


true
true
Home 
  Java Book 
    Essential Classes  

Double:
  1. Double class
  2. Constants in Double class
  3. Double class Constructor
  4. Return double value as byte, double, float, int, long, short
  5. Compare two double values
  6. Is a double value an infinite large value, or it is not a number.
  7. Convert string value to double
  8. Convert double value from string
  9. Get the hexadecimal string representation
  10. Bit oriented calculation for double type