public static int [ ] stringToCodePoints ( final String s ) { final int m = s . codePointCount ( 0 , s . length ( ) ) ; final int [ ] codePoints = new int [ m ] ; int j = 0 ; for ( int offset = 0 ; offset < s . length ( ) ; ) { final int codepoint = s . codePointAt ( offset ) ; codePoints [ j ++ ] = codepoint ; offset += Character . charCount ( codepoint ) ; } return codePoints ; }
Create Unicode code points from a String .