我见过的最好实现方法:
public static String cut(String str, int bytesCount){
byte[] bytes = str.getBytes();
char[] chars = new String(bytes, 0, bytesCount).toCharArray();
char[] charsPlus = new String(bytes, 0, bytesCount+1).toCharArray();
if (chars.length == charsPlus.length) {
return new String(bytes, 0, bytesCount - 1);
}
return new String(bytes, 0, bytesCount);
}