Java Data Type Tutorial - Java Math.scalb(double d, int scaleFactor)








Syntax

Math.scalb(double d, int scaleFactor) has the following syntax.

public static double scalb(double d,  int scaleFactor)

Example

In the following code shows how to use Math.scalb(double d, int scaleFactor) method.

/*from ww w  .  j  a v a 2s .  com*/
public class Main {

   public static void main(String[] args) {

      double x = 12.34;
      int y = 4;

      // calculate x multiplied by 2 raised in y
      System.out.println("Math.scalb(" + x + "," + y + ")=" + Math.scalb(x, y));

   }
}

The code above generates the following result.