/** * Word wraps a <code>String</code> to be no longer than the provided number of characters wide. * * @deprecated Use new version with Appendable for higher performance */ @Deprecated public static String wordWrap(String string, int width) { // Leave room for two word wrap characters every width / 2 characters, on average. int inputLength = string.length(); int estimatedLines = 2 * inputLength / width; int initialLength = inputLength + estimatedLines * 2; try { StringBuilder buffer = new StringBuilder(initialLength); wordWrap(string, width, buffer); return buffer.toString(); } catch(IOException e) { // Java 1.7: direct constructor AssertionError ae = new AssertionError("Should not get IOException from StringBuilder"); ae.initCause(e); throw ae; } }