code: public static String tryToTrimToSize(String s, int length, boolean trimSuffix) {
          if (s == null || s.isEmpty()) {
              return s;
          } else if (s.length() <= length) {
              return s;
          } else if (s.contains(File.separator)) {
              String before = s.substring(0, s.lastIndexOf(File.separator));
              String after = s.substring(s.lastIndexOf(File.separator));
              if (!trimSuffix && length - after.length() > 4) {
                  return Strings.tryToTrimToSize(before, length - after.length(), true) + after;
              } else {
                  return Strings.tryToTrimToSize(before, length - 3, true) + File.separator + "..";
              }
          } else {
              return "..";
          }
      }
docs: Try to trim a String to the given size.
  
  @param s             The String to trim.
  @param length        The trim length.
  @param trimSuffix    Flag the specifies if trimming should be applied to the suffix of the String.
  @return