Java .scalb()
Published Nov 28, 2022
Contribute to Docs
The Math.scalb() method returns the first argument multiplied by 2 to the power of the second argument.
Syntax
Math.scalb(value, scale)
The parameter value is of type double and the parameter scale is of type int.
Example
// Main.javapublic class Main {public static void main(String[] args) {double value = 23.2;int scale = 4;int scale2 = 7;System.out.println(Math.scalb(value, scale));System.out.println(Math.scalb(value, scale2));}}
This will produce the following output:
371.22969.6
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Java on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.
- Beginner Friendly.17 hours