NumberFormat isGroupingUsed() method in Java with Examples Last Updated : 01 Apr, 2019 Comments Improve Suggest changes Like Article Like Report The isGroupingUsed() method is a built-in method of the java.text.NumberFormat returns true is grouping is used in the given format, else it returns false. The grouping in English Locale for a number 567879 can be done as "5, 67, 879", where the size if locale dependent and is determined by its subclass Syntax: public boolean isGroupingUsed() Parameters: The function does not accepts any parameter. Return Value: The function returns a boolean value, it returns true if grouping can be used in this format, else false. 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 .getPercentInstance( Locale.US); // Prints the hash-code value if (nF.isGroupingUsed()) System.out.println("Yes!" + " grouping is used"); else System.out.println("No!" + " grouping is used"); } } Output: Yes! grouping is used 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 .getPercentInstance( Locale.CANADA); // Prints the hash-code value if (nF.isGroupingUsed()) System.out.println("Yes! " + "grouping is used"); else System.out.println("No! " + "grouping is used"); } } Output: Yes! grouping is used Reference: https://docs.oracle.com/javase/10/docs/api/java/text/NumberFormat.html#isGroupingUsed() Comment More infoAdvertise with us Next Article NumberFormat isGroupingUsed() 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 setGroupingUsed() method in Java with Examples The setGroupingUsed() method is a built-in method of the java.text.NumberFormat which sets the grouping to be used. Syntax: public void setGroupingUsed(boolean val) Parameters: The function accepts a mandatory parameter val which specifies the grouping to be set. Return Value: The function returns n 1 min read NumberFormat setParseIntegerOnly() method in Java with Examples The setParseIntegerOnly() method is a built-in method of the java.text.NumberFormat which sets whether or not numbers should be parsed as integers only. Syntax: public void setParseIntegerOnly(boolean val) Parameters: The function accepts a mandatory parameter val which specifies the value to be set 1 min read Matcher group() method in Java with Examples The group() method of Matcher Class is used to get the input subsequence matched by the previous match result. Syntax: public String group() Parameters: This method do not takes any parameter. Return Value: This method returns the String which is the input subsequence matched by the previous match. 2 min read Matcher group(int) method in Java with Examples The group(int group) method of Matcher Class is used to get the group index of the match result already done, from the specified group. Syntax: public String group(int group) Parameters: This method takes a parameter group which is the group from which the group index of the matched pattern is requi 2 min read MatchResult group() method in Java with Examples The group() method of MatchResult Interface is used to get the input subsequence matched by the previous match result.Syntax: public String group() Parameters: This method do not takes any parameter.Return Value: This method returns the String which is the input subsequence matched by the previous m 2 min read Like