Java Character getNumericValue() Method12 Dec 2024 | 2 min read The getNumericValue() method of character class returns the int value of the specified character. If the character does not have any int value, -1 is returned. If the character has a numeric value that cannot be represented as a non-negative integer, -2 is returned. SyntaxParameterThe above method requires only one parameter: The codePoint is the character(Unicode code point) to be converted. Return ValueThe getNumericValue(int codePoint) method returns the numeric value of the character, as a non-negative int value. This method will return -2 if the character has a numeric value but the value cannot be represented as a non-negative int value. The method will return -1 if the character has no numeric value.. Example 1Output: The character 'n' has a numeric value represented as: 23 Example 2Output: Numeric value for code point obj1 is 33 Numeric value for code point obj2 is -1 Example 3Output: The character 'n' has a numeric value represented as: 23 The character ' ' has a numeric value represented as: -1 The character '6' has a numeric value represented as: 6 Next TopicJava-character-gettype-method |
The valueOf(char c)method of Character class returns the instance of the Character which represents the given char value. If the new object of the Character is not required, then the method should be used in preference to the constructor Character(char). The above method is likely to provide...
2 min read
The isBmpCodePoint(int codePoint() method of Character class generally determines whether the given(or specified) Unicode character lies in the range of Basic Multilingual Plane(BMP). These specified codePoints can be represented through a single char value. Syntax public static Boolean isBmpCodePoint(int codePoint) Parameter The above method requires only one parameter: a.)The codePoint which...
3 min read
The isJavaIdentifierPart(char ch) method of character class determines whether the given (or specified) character is a part of Java identifier or not. The given character is a part of a Java identifier if any of the following condition is true: The character is a letter. The character is a...
6 min read
The isDefined(char ch) method of Character class generally determines whether the character is defined in the Unicode or not. A character is defined in Unicode if and only if any of the two conditions are satisfied(or true): The character must have an entry made in the UnicodeData file. The...
4 min read
The isLetterOrDigit(char ch) method of character class determines whether the given(or specified) character is a letter or digit or not. A character is considered to be a letter or digit if the Character.isLetter(char ch) or the Character.isDigit(char ch) method true for the given character. Note: The above method...
9 min read
The isSpaceChar(char ch) method of Character class determines whether the given(or specified) character is a Unicode space character. The given(or specified) character is considered to be a space character if the character is specified as a space character by the Unicode Standard. The above method returns true...
4 min read
The isLowSurrogate(char ch) method of character class determines whether the given(or specified) character is a Unicode low-surrogate code unit (which is also known as trailing-surrogate code unit). These values do not represent the characters by themselves, rather than these values are used to represent the supplementary characters...
5 min read
The reverseBytes(char ch) method of Character class returns the values obtained by reversing the bytes in a particular order for a given value. Syntax public static char reverseBytes(char ch) Parameter ch: It is the character that needs to be tested. Return Value The reverseBytes(char ch)method returns the value which is obtained by...
3 min read
The isSpace(char ch)method of Character class determines whether the given(or specified) character is ISO-LATIN-1 white space. The given method returns true for the following five characters: '\t' U+0009 HORIZONTAL TABULATION '\n' U+000A NEW LINE '\f' U+000C FORM FEED '\r' U+000D CARRIAGE RETURN ' '...
2 min read
This Method has 2 types of syntax. Java Character codePointCount(char[]a, int offset, int count) Method The codePointCount(char[]a, int offset, int count) method is used to return the number of Unicode code points in the sub array of the char array. The offset argument is the index of the...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India