java.lang.Character getDirectionality(int codePoint)

Description

The Character.getDirectionality(int codePoint) java method returns the Unicode directionality property for the given character (Unicode code point). Character directionality is used to calculate the visual ordering of text. The directionality value of undefined character is DIRECTIONALITY_UNDEFINED.

The getDirectionality(int codepoint) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:

Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java getDirectionality() method non statically.

Method Syntax

public static byte getDirectionality(int codePoint)

Method Argument

Data Type Parameter Description
int codepoint the character (Unicode code point) for which the directionality property is requested.

Method Returns

The getDirectionality(int codePoint) method of Character class returns byte which denotes the directionality property of the character.

Compatibility

Requires Java 1.5 and up

Java Character getDirectionality(int codePoint) Example

Below is a simple java example on the usage of getDirectionality(int codePoint) method of Character class.

Sample Output

Below is the sample output when you run the above example.

java Character getDirectionality(int codepoint) example output