Here you can find the source of cutoff(String value, int length)
public static String cutoff(String value, int length)
//package com.java2s; public class Main { public static String cutoff(String value, int length) { if (isNullOrEmpty(value) == false && value.length() > length) { return value.substring(0, length - 1) + ".."; }//from w w w .j a va 2s. c om return value; } public static boolean isNullOrEmpty(String input) { if (input == null) { return true; } return input.trim().isEmpty(); } }