I found one tricky place and couldn't find any answer why this exactly happen.
The main problem is how long is string.
Whether it contains one or two character.
Code:
public class App {
public static void main(String[] args) throws Exception {
char ch0 = 55378;
char ch1 = 56816;
String str = new String(new char[]{ch0, ch1});
System.out.println(str);
System.out.println(str.length());
System.out.println(str.codePointCount(0, 2));
System.out.println(str.charAt(0));
System.out.println(str.charAt(1));
}
}
Output:
?
2
1
?
?
Any suggestions?