Here you can find the source of shorten(String string, boolean isPrefix)
protected static String shorten(String string, boolean isPrefix)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 itemis AG (http://www.itemis.eu) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ public class Main { protected static String shorten(String string, boolean isPrefix) { if (string.length() > 10) if (isPrefix) return "..." + string.substring(string.length() - 10); else// www . java 2 s.c o m return string.substring(0, 10) + "..."; else return string; } }