DecimalFormat setRoundingMode() method in Java Last Updated : 01 Apr, 2019 Comments Improve Suggest changes Like Article Like Report The setRoundingMode() method is a built-in method of the java.text.DecimalFomrat class in Java and is used to set the RoundingMode to be used with this DecimalFormat instance to round-off the decimal digits. Syntax: public void setRoundingMode(RoundingMode roundingMode) Parameters: The function accepts a single parameter roundingMode which is the RoundingMode instance to be set for this DecimalFormat instance. Return Value: The function does not returns any value. Below is the implementation of the above function: Program 1: Java // Java program to illustrate the // setRoundingMode() method import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.math.RoundingMode; import java.util.Currency; import java.util.Locale; public class Main { public static void main(String[] args) { // Create the DecimalFormat Instance DecimalFormat deciFormat = new DecimalFormat(); // Set the rounding mode as CEILING deciFormat.setRoundingMode(RoundingMode.CEILING); System.out.println(deciFormat.format(1234.5555)); } } Output: 1, 234.556 Program 2: Java // Java program to illustrate the // setRoundingMode() method import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.math.RoundingMode; import java.util.Currency; import java.util.Locale; public class Main { public static void main(String[] args) { // Create the DecimalFormat Instance DecimalFormat deciFormat = new DecimalFormat(); // Set the rounding mode as HALF_DOWN deciFormat.setRoundingMode(RoundingMode.HALF_DOWN); System.out.println(deciFormat.format(1234.5555)); } } Output: 1, 234.555 Reference: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html#setRoundingMode(java.math.RoundingMode) Comment More infoAdvertise with us Next Article DecimalFormat setRoundingMode() method in Java G gopaldave Follow Improve Article Tags : Java Java-Functions Java-text package Java-DecimalFormat Practice Tags : Java Similar Reads DecimalFormat setGroupingSize() method in Java The setGroupingSize() method is a built-in method of the java.text.DecimalFomrat class in Java and is used to set the grouping size for this DecimalFormat instance or not. The grouping size is the number of integers in each group in the integral part of a decimal number. For example, the grouping si 2 min read DecimalFormat setMultiplier() method in Java The setMultiplier() method is a built-in method of the java.text.DecimalFomrat class in Java and is used to a multiplier value to be used with this DecimalFormat instance. This multiplier value can be used while working with percent, percentile etc. For Example, for a multiplier value 10, the number 1 min read DecimalFormat setCurrency() method in Java The setCurrency() method is a built-in method of the java.text.DecimalFomrat class in Java and is used to set the Currency for this DecimalFormat instance which will be used to formatting numbers. Syntax: public void setCurrency(Currency currency) Parameters: The function accepts a single parameter 1 min read DecimalFormat setParseBigDecimal() method in Java The setParseBigDecimal() method of the DecimalFormat class in Java is used to set whether the parse() method of the DecimalFormat class will return a value of BigInteger type or not. If this method is set true, then the parse() method will return a BigDecimal value. Syntax: public void setParseBigDe 1 min read DecimalFormat setMinimumFractionDigits() method in Java The setMinimumFractionDigits() method is a built-in method of the java.text.DecimalFomrat class in Java and is used to set the minimum number of digits allowed in the fractional part of a number. The fractional part of a number is the part displayed after the decimal(.) symbol. Syntax: public void s 1 min read Like