Here you can find the source of truncateData(String data, int idLength)
public static String truncateData(String data, int idLength)
//package com.java2s; public class Main { public static String truncateData(String data, int idLength) { //TODO: Handle the case of unicode chars where string.length() <> byte length String truncateData = data; if (data != null && data.length() > idLength) { truncateData = data.substring(0, (idLength - 1)); }/* ww w. j a va2 s . co m*/ return truncateData; } }