Java Character getDirectionality() MethodThe getDirectionality(char ch) method of Character class is used to return the property of unicode directionality for the given character. Generally, character directionality calculates the visual ordering of the text. The directionality value of undefined char value is DIRECTIONALITY_UNDEFINED. SyntaxParameterch: It is the char for which the directionality property is requested. Return ValueIt returns the directionality property of the char value. Example 1Output: The directionality of Q is 0 The directionality of 1 is 3 Example 2Output: Enter the first input:D The Unicode directionality property for the character D is 0 Enter the second input:4 The Unicode directionality property for the character 4 is 3 Example 3Output: Directionality of first primitive is 4 Directionality of second primitive is 13 Java Character getDirectionality() MethodThe getDirectionality(int codePoint) method of Character class is used to return the unicode directionality property for the given character. Generally, character directionality is used to calculate the visual ordering of the text. The directionality value for undefined char value is DIRECTIONALITY_UNDEFINED. SyntaxParameterThe above method requires only one parameter: codePoint: It is the character(Unicode code point) for which the directionality property is requested. Return ValueThe getDirectionality(int codePoint) method returns the directionality property of the character. Example 1Output: codePoint: 36 Unicode directionality property for the first codePoint is: 5 codePoint: 36 Unicode directionality property for the second codePoint is: 1 Example 2Output: Directionality for first codePoint is 0 Directionality of second codePoint is 13 Example 3Output: codePoint: 36 Unicode directionality property for the first codePoint is: 5 codePoint: 2001 Unicode directionality property for the second codePoint is: 1 codePoint: 0 Unicode directionality property for the second codePoint is: 9 Next TopicJava-character-getname-method |