Java Data Type Tutorial - Java StrictMath.getExponent(double d)








Syntax

StrictMath.getExponent(double d) has the following syntax.

public static int getExponent(double d)

Example

In the following code shows how to use StrictMath.getExponent(double d) method.

//from w ww. ja  v  a2  s .  c o m

public class Main {

  public static void main(String[] args) {
  
    double d1 = 16.2 , d2 = 512.3;

    // returns the unbiased exponent used in the representation of a double
    double exponentValue = StrictMath.getExponent(d1); 
    System.out.println("Exponent value of " + d1 + " = " + exponentValue);
        
    exponentValue = StrictMath.getExponent(d2); 
    System.out.println("Exponent value of " + d2 + " = " + exponentValue);
  }
}

The code above generates the following result.