public static int toCodePoints(char[] src, int srcOff, int srcLen, int[] dest, int destOff) {if (srcLen < 0) {throw new IllegalArgumentException("srcLen must be >= 0");}int codePointCount = 0;for (int i = 0; i < srcLen; ) {final int cp = Character.codePointAt(src, srcOff + i, srcOff + srcLen);final int charCount = Character.charCount(cp);dest[destOff + codePointCount++] = cp;i += charCount;}return codePointCount;}

public int ToCodePoints(char[] src, int srcOff, int srcLen, int[] dest, int destOff){if (srcLen < 0){throw new ArgumentException("srcLen must be >= 0");}int codePointCount = 0;for (int i = 0; i < srcLen; ){int cp = CodePointAt(src, srcOff + i, srcOff + srcLen);int charCount = Character.CharCount(cp);dest[destOff + codePointCount++] = cp;i += charCount;}return codePointCount;}
