Here you can find the source of CodePointAt(String str, int index, int endIndex)
private static int CodePointAt(String str, int index, int endIndex)
//package com.java2s; public class Main { private static int CodePointAt(String str, int index, int endIndex) { if (str == null) { throw new NullPointerException("str"); }/*from ww w . j a va 2 s . co m*/ if (index >= endIndex) { return -1; } if (index < 0) { return -1; } int c = str.charAt(index); if ((c & 0xfc00) == 0xd800 && index + 1 < endIndex && str.charAt(index + 1) >= 0xdc00 && str.charAt(index + 1) <= 0xdfff) { // Get the Unicode code point for the surrogate pair c = 0x10000 + ((c - 0xd800) << 10) + (str.charAt(index + 1) - 0xdc00); ++index; } else if ((c & 0xf800) == 0xd800) { // unpaired surrogate return 0xfffd; } return c; } }