Skip to content

Commit 2aca6e0

Browse files
yasin3061maibin
authored andcommitted
BAEL-745 Quick Math.pow example (eugenp#1482)
* yasin.bhojawala@gmail.com Evaluation article on Different Types of Bean Injection in Spring * Revert "yasin.bhojawala@gmail.com" This reverts commit 963cc51. * 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
1 parent 092d883 commit 2aca6e0

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.baeldung.pow;
2+
3+
import java.text.DecimalFormat;
4+
5+
public class PowerExample {
6+
7+
public static void main(String[] args) {
8+
9+
int intResult = (int) Math.pow(2, 3);
10+
System.out.println("Math.pow(2, 3) = " + intResult);
11+
12+
double dblResult = Math.pow(4.2, 3);
13+
System.out.println("Math.pow(4.2, 3) = " + Math.pow(4.2, 3));
14+
15+
DecimalFormat df = new DecimalFormat(".00");
16+
System.out.println("Math.pow(4.2, 3) rounded = " + df.format(dblResult));
17+
18+
}
19+
}

0 commit comments

Comments
 (0)