Here you can find the source of abbreviate(String text, int maxFront, int maxBack)
public static String abbreviate(String text, int maxFront, int maxBack)
//package com.java2s; /*//from w w w . jav a 2 s. co m (C) 2007 Stefan Reich (jazz@drjava.de) This source file is part of Project Prophecy. For up-to-date information, see http://www.drjava.de/prophecy This source file is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1. */ public class Main { public static String abbreviate(String text, int maxFront, int maxBack) { if (text.length() > maxFront + maxBack - 3) { text = text.substring(0, maxFront) + "..." + text.substring(text.length() - maxBack, text.length()); } return text; } /** abbreviate to default length */ public static String abbreviate(String text) { return abbreviate(text, 40, 20); } }