Character.getDirectionality(int codePoint) has the following syntax.
public static byte getDirectionality(int codePoint)
In the following code shows how to use Character.getDirectionality(int codePoint) method.
//from ww w . j a va2s . c om public class Main { public static void main(String[] args) { char ch1 = 'M', ch2 = '\u06aa'; byte b1 = Character.getDirectionality(ch1); byte b2 = Character.getDirectionality(ch2); if(b1 == 0){ System.out.println("DIRECTIONALITY_LEFT_TO_RIGHT"); } if(b2 == 2){ System.out.println("DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC"); } } }
The code above generates the following result.