NumberFormat isParseIntegerOnly() method in Java with Examples Last Updated : 01 Dec, 2020 Comments Improve Suggest changes Like Article Like Report The isParseIntegerOnly() method is a built-in method of the java.text.NumberFormat which returns true if numbers are parsed as integers in this format. For example in the English locale, with ParseIntegerOnly true, the string "5678." would be parsed as the integer value 5678 and parsing would stop at the "." character. Syntax: public boolean isParseIntegerOnly() Parameters: The function does not accept any parameter. Return Value: The function returns a boolean value, it returns true if numbers can be parsed as integers, else it returns 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); // Check if (nF.isParseIntegerOnly()) System.out.println("isParseIntegerOnly: Yes"); else System.out.println("isParseIntegerOnly: No"); } } Output: isParseIntegerOnly: No 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); // Check if (nF.isParseIntegerOnly()) System.out.println("isParseIntegerOnly: Yes"); else System.out.println("isParseIntegerOnly: No"); } } Output: isParseIntegerOnly: No Reference: https://docs.oracle.com/javase/10/docs/api/java/text/NumberFormat.html#isParseIntegerOnly() Comment More infoAdvertise with us Next Article NumberFormat isParseIntegerOnly() 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 isGroupingUsed() method in Java with Examples 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 subc 2 min read NumberFormat getMinimumIntegerDigits() method in Java with Examples The getMinimumIntegerDigits() method is a built-in method of the java.text.NumberFormat returns the minimum number of digits allowed in the integer portion of a number of an instance. Syntax: public int getMinimumIntegerDigits() Parameters: The function does not accepts any parameter. Return Value: 2 min read 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 NumberFormat equals() method in Java with Examples The equals() method is a built-in method of the java.text.NumberFormat accepts an argument which is an object and returns true if this argument object is same as the object, else it returns false. Syntax: public boolean equals(Object arg) Parameters: The function accepts a single mandatory parameter 2 min read OptionalInt isPresent() method in Java with examples OptionalInt help us to create an object which may or may not contain a Int value. The isPresent() method help us to get the answer that Int value is present in OptionalInt object or not. If an int value is present in this object, this method returns true, otherwise false. Syntax: public boolean isPr 1 min read Like