Here you can find the source of shorten(String s)
public static String shorten(String s)
//package com.java2s; //License from project: Apache License public class Main { public static String shorten(String s) { return shorten(s, 20); }/* ww w .j a va2 s . c om*/ public static String shorten(String s, int length) { return shorten(s, length, ".."); } public static String shorten(String s, String suffix) { return shorten(s, 20, suffix); } public static String shorten(String s, int length, String suffix) { if (s == null || suffix == null) { return null; } if (s.length() > length) { s = s.substring(0, length) + suffix; } return s; } }