1 package sortandcollections;
2
3 import java.util.ArrayList;
4 import java.util.List;
5 import java.util.TreeSet;
6
7 /**
8 *
9 * @author Lowitty
10 */
11 public class SortAndCollections {
12
13 /**
14 * @param args the command line arguments
15 */
16 public static void main(String[] args) {
17 String s = "皙殽asdf涓嶅拫鍜嬪湴鍗○獨ラ粵鍜嬬強asd皙殽has鍜媎皙殽adn皙殽sad皙殽";
18 int cpCount = s.codePointCount(0, s.length());
19 int firCodeIndex = s.offsetByCodePoints(0, 0);
20 int lstCodeIndex = s.offsetByCodePoints(0, cpCount - 1);
21
22 System.out.println(firCodeIndex + "\n" + lstCodeIndex + "\n" + cpCount + "\n" + s.length());
23
24 int counter = 0;
25
26 for(int index = firCodeIndex ; index <= lstCodeIndex;index += ((Character.isSupplementaryCodePoint(s.codePointAt(index)))?2:1)){
27 counter ++;
28 System.out.println(counter + "\t"
29 +index + "\t"
30 +s.codePointAt(index) +"\t"
31 + Character.charCount(s.codePointAt(index)) + "\t"
32 + Character.getName(s.codePointAt(index)) + "\t\t\t"
33 + String.valueOf(Character.toChars(s.codePointAt(index))));
34 }
35 }
36 }