Skip to content

Instantly share code, notes, and snippets.

@javamultiplex
Created August 28, 2017 18:13
Show Gist options
  • Save javamultiplex/a2919d6eb6a6888e58f3e860863db0cb to your computer and use it in GitHub Desktop.
Save javamultiplex/a2919d6eb6a6888e58f3e860863db0cb to your computer and use it in GitHub Desktop.
java.lang.Character.charCount()
package com.javamultiplex.java.lang.character;
/**
* @author Rohit Agarwal
* @category java.lang/Character/charCount()
* @version 1.0
*/
public class CharCount {
public static void main(String[] args) {
// Case 1: codePoint is less than 0X10000 or 65536. It returns 1.
int i = Character.charCount(12);
System.out.println(i);
// Case 2: codePoint is equal to 0X10000 or 65536. It returns 2.
int j = Character.charCount(65536);
System.out.println(j);
// Case 3: codePoint is greater than 0X10000 or 65536. It returns 2.
int k = Character.charCount(65590);
System.out.println(k);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment