This method will return the ellipsized String:
String ellipsize(String input, int maxLength) {
String ellip = "...";
if (input == null || input.length() <= maxLength
|| input.length() < ellip.length()) {
return input;
}
return input.substring(0, maxLength - ellip.length()).concat(ellip);
}