Here you can find the source of truncateMessage(String message, int TRUNCATED_MSG_SIZE)
public static String truncateMessage(String message, int TRUNCATED_MSG_SIZE)
//package com.java2s; /**//from w w w . j av a 2 s. co m * License: https://github.com/votingsystem/votingsystem/wiki/Licencia */ public class Main { public static String truncateMessage(String message, int TRUNCATED_MSG_SIZE) { if (message != null && message.length() > TRUNCATED_MSG_SIZE) return message.substring(0, TRUNCATED_MSG_SIZE) + "..."; else return message; } }