Skip to content

Commit

Permalink
Move away from deprecated BigDecimal.valueOf method
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Sep 22, 2021
1 parent 5b91e61 commit a3d319c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.quarkus.bootstrap.graal.ImageInfo;
import io.quarkus.bootstrap.logging.InitialConfigurator;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.logging.Handler;
import org.jboss.logging.Logger;

Expand Down Expand Up @@ -133,8 +134,8 @@ public static void printStopTime(String name, boolean auxiliaryApplication) {

public static BigDecimal convertToBigDecimalSeconds(final long timeNanoSeconds) {
final BigDecimal secondsRepresentation = BigDecimal.valueOf(timeNanoSeconds) // As nanoseconds
.divide(BigDecimal.valueOf(1_000_000), BigDecimal.ROUND_HALF_UP) // Convert to milliseconds, discard remaining digits while rounding
.divide(BigDecimal.valueOf(1_000), 3, BigDecimal.ROUND_HALF_UP); // Convert to seconds, while preserving 3 digits
.divide(BigDecimal.valueOf(1_000_000), RoundingMode.HALF_UP) // Convert to milliseconds, discard remaining digits while rounding
.divide(BigDecimal.valueOf(1_000), 3, RoundingMode.HALF_UP); // Convert to seconds, while preserving 3 digits
return secondsRepresentation;
}

Expand Down

0 comments on commit a3d319c

Please sign in to comment.