Java tutorial
public class Main { public static void main(String[] args) { int cp = 0x12345; int res = Character.charCount(cp); String str1 = "It is not a valid supplementary character"; String str2 = "It is a valid supplementary character"; if (res == 1) { System.out.println(str1); } else if (res == 2) { System.out.println(str2); } } }