Here you can find the source of ellipsis(final String text, int length)
public static String ellipsis(final String text, int length)
//package com.java2s; //License from project: Open Source License public class Main { public static String ellipsis(final String text, int length) { if (text.length() <= length) return text; return text.substring(0, length - 3) + "..."; }// www . j a v a 2s .c o m }