Here you can find the source of unicodePreservingIndex(String paramString, int paramInt)
public static int unicodePreservingIndex(String paramString, int paramInt)
//package com.java2s; public class Main { public static int unicodePreservingIndex(String paramString, int paramInt) { if (paramInt > 0) { int i = paramString.length(); if (paramInt < i) { int j = paramInt + -1; if ((Character.isHighSurrogate(paramString.charAt(j))) && (Character.isLowSurrogate(paramString .charAt(paramInt)))) paramInt += -1;//ww w. ja v a 2s . c o m } } return paramInt; } }