-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathMath.java
More file actions
28 lines (25 loc) · 930 Bytes
/
Copy pathMath.java
File metadata and controls
28 lines (25 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//example from https://docs.openrewrite.org/running-recipes/popular-recipe-guides/migrate-to-java-17
package com.amazonaws.samples.appconfig.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Math {
Boolean bool = Boolean.valueOf(true);
Byte b = Byte.valueOf("1");
Character c = Character.valueOf('c');
Double d = Double.valueOf(1.0);
Float f = Float.valueOf(1.1f);
Long l = Long.valueOf(1);
Short sh = Short.valueOf("12");
short s3 = 3;
Short sh3 = Short.valueOf(s3);
Integer i = Integer.valueOf(1);
public void divide() {
BigDecimal bd = BigDecimal.valueOf(10);
BigDecimal bd2 = BigDecimal.valueOf(2);
bd.divide(bd2, RoundingMode.DOWN);
bd.divide(bd2, RoundingMode.DOWN);
bd.divide(bd2, 1, RoundingMode.CEILING);
bd.divide(bd2, 1, RoundingMode.DOWN);
bd.setScale(2, RoundingMode.DOWN);
}
}