public static String truncate(final String string,final int maxLen){
  if (string.length() <= maxLen)   return string;
 else   return string.substring(0,maxLen);
}

public static String truncate ( final String string , final int maxLen ) { if ( string . length ( ) <= maxLen ) return string ; else return string . substring ( 0 , maxLen ) ; }
returns a truncated string , up to the maximum number of characters
