char codePoint = '\u0061'; // Unicode code point for lowercase 'a' int count = Character.charCount(codePoint); System.out.println(count); // Output: 1
char[] codePoints = Character.toChars(0x1F60A); // Unicode code point for smiling face with heart-shaped eyes int count1 = Character.charCount(codePoints[0]); int count2 = Character.charCount(codePoints[1]); System.out.println(count1 + count2); // Output: 2In both examples, the Character class is used to count the number of char values required to represent a Unicode character. Therefore, the package library is "java.lang".