public static String abbreviate(String str,int maxWidth){
  if (str == null) {
    return null;
  }
  if (str.length() < maxWidth) {
    return str;
  }
  if (maxWidth < 4) {
    throw new IllegalArgumentException("Minimum required width is 4");
  }
  return str.substring(0,maxWidth - 3) + "...";
}

public static String abbreviate ( String str , int maxWidth ) { if ( str == null ) { return null ; } if ( str . length ( ) < maxWidth ) { return str ; } if ( maxWidth < 4 ) { throw new IllegalArgumentException ( "Minimum required width is 4" ) ; } return str . substring ( 0 , maxWidth - 3 ) + "..." ; }
abbreviates a string using ellipses . stringutils . abbreviate ( " abcdefg " , 6 ) = " abc . . . "
