Character.toChars(int codePoint) has the following syntax.
public static char[] toChars(int codePoint)
In the following code shows how to use Character.toChars(int codePoint) method.
/*w w w.j a va 2 s. c om*/ public class Main { public static void main(String[] args) { int cp = 0x006f; char[] ch = Character.toChars(cp); System.out.print( "Char array having cp's UTF-16 representation is " ); for (int i=0; i<ch.length; i++){ System.out.print( ch[i] ); } } }
The code above generates the following result.