How to determine if number of char value needed to represent the specified character (Unicode code) in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {
 
    public static void main(String[] args) {
        
        int codePoint = 0x1234;

        int i = Character.charCount(codePoint);

        if ( i == 1 )
            System.out.println("no");
        else if ( i == 2 )
            System.out.println("yes");
    }
}
 
/*
run:

no
 
*/

 



answered Sep 11, 2016 by avibootz
...