Java Character.toChars(int codePoint, char[] dst, int dstIndex)
Syntax
Character.toChars(int codePoint, char[] dst, int dstIndex) has the following syntax.
public static int toChars(int codePoint, char[] dst, int dstIndex)
Example
In the following code shows how to use Character.toChars(int codePoint, char[] dst, int dstIndex) method.
public class Main {
/*from w ww .ja v a2 s .c o m*/
public static void main(String[] args) {
int cp = 0x0036;
char dst[] = Character.toChars(cp);
int res = Character.toChars(cp, dst, 0);
if ( res == 1 ){
System.out.println( "It is a BMP code point" );
}
else if ( res == 2 ){
System.out.println( "It is a is a supplementary code point" );
}
}
}
The code above generates the following result.