Here you can find the source of abbreviate(String s, int maxLength)
public static String abbreviate(String s, int maxLength)
//package com.java2s; //License from project: LGPL public class Main { public static String abbreviate(String s, int maxLength) { s = String.valueOf(s); // null check if (s.length() > maxLength) { s = s.substring(0, maxLength) + "..."; }/*from w ww. ja v a2s . c o m*/ return s; } }