BAEL-745 Quick Math.pow example (#1482)
* yasin.bhojawala@gmail.com
Evaluation article on Different Types of Bean Injection in Spring
* Revert "yasin.bhojawala@gmail.com"
This reverts commit 963cc51a7a.
* Fixing compilation error and removing unused import
* Introduction to Java9 StackWalking API - yasin.bhojawala@gmail.com
Code examples for the article "Introduction to Java9 StackWalking API"
* BAEL-608 Introduction to Java9 StackWalking API
* BAEL-608 Introduction to Java9 StackWalking API
changing the test names to BDD style
* BAEL-608 Introduction to Java9 StackWalking API
correcting the typo
* BAEL-608 Introduction to Java9 StackWalking API
improving method names
* BAEL-608 Introduction to Java9 StackWalking API
test method names improvements
* BAEL-718 Quick intro to javatuples
* merging pom from master
* BAEL-722 Intro to JSONassert
* BAEL-722 Intro to JSONassert
Updated to 1.5.0
* BAEL-745 Quick Math.pow example
This commit is contained in:
19
core-java/src/main/java/com/baeldung/pow/PowerExample.java
Normal file
19
core-java/src/main/java/com/baeldung/pow/PowerExample.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.baeldung.pow;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class PowerExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
int intResult = (int) Math.pow(2, 3);
|
||||
System.out.println("Math.pow(2, 3) = " + intResult);
|
||||
|
||||
double dblResult = Math.pow(4.2, 3);
|
||||
System.out.println("Math.pow(4.2, 3) = " + Math.pow(4.2, 3));
|
||||
|
||||
DecimalFormat df = new DecimalFormat(".00");
|
||||
System.out.println("Math.pow(4.2, 3) rounded = " + df.format(dblResult));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user