public static String truncate(String str, int max, boolean trimBack) {
		if (str.length() < max) {
			return str;
		} else {
			if (trimBack)
				return str.substring(0, max - 3) + "...";
			else
				// trim from front
				return "..." + str.substring(str.length() - (max - 3), str.length());
		}
	}