Here you can find the source of abbrev(String result, int maxLength, String separator)
public static String abbrev(String result, int maxLength, String separator)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . ja v a 2s . c o m*/ * Make sure a string stays within a certain length, by cutting a bit from the middle. */ public static String abbrev(String result, int maxLength, String separator) { int mid = maxLength / 2; if (result.length() > maxLength) result = result.substring(0, mid - 1) + separator + result.substring(result.length() - mid); return result; } }