Skip to content

Commit eb1620c

Browse files
committed
BigDecimal: instantiating
1 parent 30d08e4 commit eb1620c

4 files changed

Lines changed: 361 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

big-decimal/gradlew

Lines changed: 234 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

big-decimal/gradlew.bat

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package me.bvn13.test.bigdecimal;
2+
3+
import java.math.BigDecimal;
4+
import java.util.Currency;
5+
6+
public class BigDecimalExample {
7+
public static void main(String[] args) {
8+
fromInteger();
9+
fromFloat();
10+
a();
11+
b();
12+
}
13+
14+
static void fromInteger() {
15+
BigDecimal amount = new BigDecimal(5);
16+
System.out.println(amount);
17+
}
18+
19+
static void fromFloat() {
20+
BigDecimal amount = new BigDecimal(5.123456789);
21+
System.out.println(amount);
22+
}
23+
24+
static void a() {
25+
BigDecimal amount = new BigDecimal("5");
26+
System.out.println(amount);
27+
}
28+
29+
static void b() {
30+
BigDecimal amount = new BigDecimal("5.123456789");
31+
System.out.println(amount);
32+
}
33+
}

0 commit comments

Comments
 (0)