Here you can find the source of truncate(String value, int length)
public static String truncate(String value, int length)
//package com.java2s; //License from project: Open Source License public class Main { public static String truncate(String value, int length) { return truncate(value, 0, length); }/*from w w w.j a v a 2 s. c o m*/ public static String truncate(String value, int start, int length) { return value.substring(start, (value.length() < length ? value.length() : length)); } }