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