class Utils {
public static String padding(String str, int repeat, char padChar) {
StringBuilder result = new StringBuilder();
int len = str.length();
if (repeat > len) {
for (int i = 0; i < (repeat - len); i++) {
result.append(padChar);
}
}
result.append(str);
return result.toString();
}
public static String truncate(String str, int len) {
if (len <= 3) {
throw new IllegalArgumentException();
}
if (str.length() > len) {
return str.substring(0, (len - 3)) + "...";
} else {
return str;
}
}
}