src/org/kocakosm/pitaya/util/Strings.java
public static String abbreviate(String str, int length, String ellipsis)
	{
		Parameters.checkCondition(length > ellipsis.length());
		if (str.length() <= length) {
			return str;
		}
		return str.substring(0, length - ellipsis.length()) + ellipsis;
	}
public static String abbreviate(String str, int length, String ellipsis)
	{
		Parameters.checkCondition(length > ellipsis.length());
		if (str.length() <= length) {
			return str;
		}
		return str.substring(0, length - ellipsis.length()) + ellipsis;
	}
Abbreviates the given {@code String} using the specified ellipsis so
that the returned {@code String}'s length is equal to {@code length}.

@param str the {@code String} to abbreviate.
@param length the desired length for the abbreviated {@code String}.
@param ellipsis the ellipsis to use to mark abbreviation.

@return the abbreviated {@code String}.

@throws NullPointerException if one of the arguments is {@code null}.
@throws IllegalArgumentException if {@code length} is too small.