[Java SE] How to Properly Specify Rounding Behavior for Decimals in Java SE 8
(Doc ID 2285184.1)
Last updated on MAY 10, 2024
Applies to:
Java SE JDK and JRE - Version 8 and laterInformation in this document applies to any platform.
Goal
You might have a program that uses the decimalFormat class for rounding arbitrary decimal values. The following sample code illustrates the technique:
Is this a bug in Java SE? How can you get the correct rounding results expected?
Solution
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Goal |
Solution |
Caution |
Sample Code |