code: public static String getLastCharacters(String s, int last) {
          int index = s.length() - last + 1;
          if (index < 0) {
              index = 0;
          }
          String result = "";
          if (index > 0) {
              result = " ... ";
          }
          result = result +  s.substring(index);
          return result;
      }
docs: Get last characters from a string : if fewer characters, the string will start with ...
  
  @param s string
  @param last last characters
  @return a string with last characters