Java Data Type Tutorial - Java Math.scalb(float f, int scaleFactor)








Syntax

Math.scalb(float f, int scaleFactor) has the following syntax.

public static float scalb(float f,  int scaleFactor)

Example

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

//w  w  w .  jav  a 2 s . c om

public class Main {

   public static void main(String[] args) {

      float x = 12.34f;
      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.