NumberFormat getRoundingMode() method in Java with Examples Last Updated : 01 Apr, 2019 Comments Improve Suggest changes Like Article Like Report The getRoundingMode() method is a built-in method of the java.text.NumberFormat returns the rounding mode which is being used in the given Number Format. Syntax: public RoundingMode getRoundingMode() Parameters: The function does not accepts any parameter. Return Value: The function returns the rounding Mode which is used for this Number Format. Below is the implementation of the above function: Program 1: Java // Java program to implement // the above function import java.text.NumberFormat; import java.util.Locale; import java.util.Currency; public class Main { public static void main(String[] args) throws Exception { // Get the instance for Locale US NumberFormat nF = NumberFormat.getInstance( Locale.US); // Prints the Rounding Mode System.out.println("The rounding mode" + " value is: " + nF.getRoundingMode()); } } Output: The rounding mode value is: HALF_EVEN Program 2: Java // Java program to implement // the above function import java.text.NumberFormat; import java.util.Locale; import java.util.Currency; public class Main { public static void main(String[] args) throws Exception { // Get the instance for Locale CANADA NumberFormat nF = NumberFormat.getInstance( Locale.CANADA); // Prints the Rounding Mode System.out.println("The rounding mode" + " value is: " + nF.getRoundingMode()); } } Output: The rounding mode value is: HALF_EVEN Reference: https://docs.oracle.com/javase/10/docs/api/java/text/NumberFormat.html#getRoundingMode() Comment More infoAdvertise with us Next Article NumberFormat getRoundingMode() method in Java with Examples G gopaldave Follow Improve Article Tags : Java Java-Functions Java-text package Java-NumberFormat Practice Tags : Java Similar Reads NumberFormat parse() method in Java with Examples The parse(str) method is a built-in method of the java.text.NumberFormat which parses text from the beginning of the given string to produce a number. The method may not use the entire text of the given string Syntax: public Number parse?(String str) Parameters: The function accepts a string str who 2 min read URL getQuery() method in Java with Examples The getQuery() function is a part of URL class. The function getQuery() returns the Query of a specified URL. Function Signature: public String getQuery() Syntax: url.getQuery() Parameter: This function does not require any parameter Return Type: The function returns String Type Query of a specified 2 min read Number.floatValue() method in java with examples The floatValue() method is an inbuilt method in Java from the java.lang.Number class. This method is used when we want to extract the value of a Number object as a float data type. This may involve rounding or truncation, because this method returns the numeric value of the current object converted 2 min read Period get() method in Java with Examples The get() method of Period class in Java is used to get the value of the requested unit(YEARS, MONTHS or DAYS) given in the argument from this Period. Syntax: public long get(TemporalUnit unit) Parameters: This method accepts a single parameter unit of type TemporalUnit which is the unit to get requ 2 min read Number.intValue() method in java with examples The intValue() is an inbuilt method provided by the abstract class java.lang.Number. This method converts a numeric object, such as Float, Double, etc., to an int type. This method may involve rounding or truncation if the original number is a floating-point value.Syntax of Number.intValue() Methodp 2 min read Like