Java Character.charCount(int codePoint)

Syntax

Character.charCount(int codePoint) has the following syntax.

public static int charCount(int codePoint)

Example

In the following code shows how to use Character.charCount(int codePoint) method.


/*from www.  j  a v  a  2  s .  c om*/
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);
    }
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable