In this example, we're showcasing Rounding Mode.
IOTester.java
import java.math.RoundingMode; import java.text.NumberFormat; import java.util.Locale; public class I18NTester { public static void main(String[] args) { Locale enLocale = new Locale("en", "US"); NumberFormat numberFormat = NumberFormat.getInstance(enLocale); numberFormat.setMinimumFractionDigits(0); numberFormat.setMaximumFractionDigits(0); System.out.println(numberFormat.format(99.50)); numberFormat.setRoundingMode(RoundingMode.HALF_DOWN); System.out.println(numberFormat.format(99.50)); } }
It will print the following result.
100 99Print