java.lang.Character.toChars(int codePoint)


java.lang.Character.toChars(int codePoint)

package com.codingdict;

import java.lang.*;

public class CharacterDemo {

   public static void main(String[] args) {

      // create a char array ch
      char ch[];

      // create an int primitive cp and assign value
      int cp = 0x006e;

      // assign result of toChars on cp to ch
      ch = Character.toChars(cp);

      String str = "Char array having cp's UTF-16 representation is ";

      System.out.print( str );

      // use a for loop to print ch
      for (int i = 0; i < ch.length; i++) {
         System.out.print( ch[i] );
      }
   }
}