Here you can find the source of subStringByByte(String paramString, int beginIndex, int endIndex)
public static String subStringByByte(String paramString, int beginIndex, int endIndex)
//package com.java2s; public class Main { public static String subStringByByte(String paramString, int beginIndex, int endIndex) { if ((paramString == null) || (paramString.length() == 0)) { return ""; }/*from w w w.j av a 2s . c om*/ if (beginIndex >= endIndex) { return ""; } int byteLength = 0; String returnString = ""; for (int i = 0; i < paramString.length(); i++) { char c = paramString.charAt(i); byteLength += (0 <= c && c <= 255) ? 1 : 2; if (byteLength > endIndex) { break; } if (byteLength > beginIndex) { returnString += c; } } return returnString; } }