code: public static CharSequence truncate(CharSequence s, int len) {
      if (s.length() == len) return (s);
      if (s.length() > len) return (s.subSequence(0, len));
      StringBuilder result = new StringBuilder(s);
      while (result.length() < len)
        result.append(' ');
      return (result);
    }
docs: Returns a string of the given length, fills with spaces if necessary