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

ReturnMethodSummary
booleanisInfinite()Returns true if this Double value is infinitely large in magnitude, false otherwise.
static booleanisInfinite(double v)Returns true if the specified number is infinitely large in magnitude, false otherwise.
booleanisNaN()Returns true if this Double value is a Not-a-Number (NaN), false otherwise.
static booleanisNaN(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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.