Surprisingly, String length more complicate than we excepted. A char is not necessarily a complete character, so if you need to know the character length, you need to use codePointCount method

  int charLen = myString.length();
  int characterLen = myString.codePointCount(0, charLen);

However, if you use UTF-8 encoding, string.length() will work as expected.

More detail see:
http://forum.java.sun.com/thread.jspa?threadID=671720