public static String trimTextDown(String text, int size) {

		if (text == null || text.length() <= size) {
			return text;
		}

		int pos = text.lastIndexOf(" ", size);

		if (pos < 0) {
			return text.substring(0, size);
		}

		return text.substring(0, pos);
	}
public static String trimTextDown(String text, int size) {

		if (text == null || text.length() <= size) {
			return text;
		}

		int pos = text.lastIndexOf(" ", size);

		if (pos < 0) {
			return text.substring(0, size);
		}

		return text.substring(0, pos);
	}
public static String trimTextDown ( String text , int size ) { if ( text == null || text . length ( ) <= size ) { return text ; } int pos = text . lastIndexOf ( " " , size ) ; if ( pos < 0 ) { return text . substring ( 0 , size ) ; } return text . substring ( 0 , pos ) ; }
Reduces text to max given size preserving words

@param text to trim down
@param size max desired size
@return trimmed down text with "..." or original text if fitting size
Reduces text to max given size preserving words