Java tutorial
//package com.java2s; public class Main { public static int getCharacterNum(final String content) { if (null == content || "".equals(content)) { return 0; } else { return (content.length() + getChineseNum(content)); } } public static int getChineseNum(String s) { int num = 0; char[] myChar = s.toCharArray(); for (int i = 0; i < myChar.length; i++) { if ((char) (byte) myChar[i] != myChar[i]) { num++; } } return num; } }