Here you can find the source of max(String content, int max, String dotDotDot)
public static String max(String content, int max, String dotDotDot)
//package com.java2s; //License from project: LGPL public class Main { /**/*from ww w .j ava 2 s . c om*/ * cut string to max size if the string is greater, otherweise to nothing * @param content * @param max * @return cutted string */ public static String max(String content, int max) { return max(content, max, ""); } public static String max(String content, int max, String dotDotDot) { if (content == null) return null; if (content.length() <= max) return content; return content.substring(0, max) + dotDotDot; } public static int length(String str) { if (str == null) return 0; return str.length(); } /** * this method works different from the regular substring method, the regular substring method takes startIndex and endIndex as second and third argument, * this method takes offset and length * @param str * @param off * @param len * @return */ public static String substring(String str, int off, int len) { return str.substring(off, off + len); } }