Here you can find the source of toCodePoints(String str)
public static int[] toCodePoints(String str)
//package com.java2s; //License from project: Apache License public class Main { public static int[] toCodePoints(String str) { int count = str.codePointCount(0, str.length()); int[] codePoints = new int[count]; for (int cpIndex = 0, charIndex = 0; cpIndex < count; cpIndex++) { int cp = str.codePointAt(charIndex); codePoints[cpIndex] = cp;//from w ww. j a v a 2 s . c om charIndex += Character.charCount(cp); } return codePoints; } }