code: public static String abbreviate(String input, int length) {
        if (input == null) {
           return null;
        }
        if (input.length() <= length) {
           return input;
        }
        return input.substring(0, length) + "...";
     }
docs: <p>Abbreviates a string to a desired length and adds "..." at the end.</p>
  
  @param input  The input string
  @param length The length of the abbreviation
  @return The abbreviated string