public static String cutEnd ( String data , int maxLength ) { if ( data . length ( ) > maxLength ) { return data . substring ( 0 , maxLength ) + "..." ; } else { return data ; } }
Cut all characters from maxLength and replace it with ...