Here you can find the source of clipText(String text, int maxLength)
public static String clipText(String text, int maxLength)
//package com.java2s; //License from project: Open Source License public class Main { public static String clipText(String text, int maxLength) { if (text.length() <= maxLength) { return text; } else {/*from www .j a va 2 s.c o m*/ return text.substring(0, maxLength) + "..."; } } }