1919
2020import java .io .PrintWriter ;
2121import java .util .ArrayList ;
22+ import java .util .Arrays ;
2223import java .util .Collection ;
2324import java .util .Collections ;
2425import java .util .Comparator ;
@@ -860,8 +861,7 @@ protected StringBuffer renderWrappedText(StringBuffer sb, int width,
860861 nextLineTabStop = 1 ;
861862 }
862863
863- // all following lines must be padded with nextLineTabStop space
864- // characters
864+ // all following lines must be padded with nextLineTabStop space characters
865865 final String padding = createPadding (nextLineTabStop );
866866
867867 while (true )
@@ -888,7 +888,7 @@ protected StringBuffer renderWrappedText(StringBuffer sb, int width,
888888 /**
889889 * Finds the next text wrap position after <code>startPos</code> for the
890890 * text in <code>text</code> with the column width <code>width</code>.
891- * The wrap point is the last postion before startPos+width having a
891+ * The wrap point is the last position before startPos+width having a
892892 * whitespace character (space, \n, \r).
893893 *
894894 * @param text The text being searched for the wrap position
@@ -953,14 +953,10 @@ else if (startPos + width >= text.length())
953953 */
954954 protected String createPadding (int len )
955955 {
956- StringBuffer sb = new StringBuffer (len );
957-
958- for (int i = 0 ; i < len ; ++i )
959- {
960- sb .append (' ' );
961- }
962-
963- return sb .toString ();
956+ char [] padding = new char [len ];
957+ Arrays .fill (padding , ' ' );
958+
959+ return new String (padding );
964960 }
965961
966962 /**
0 commit comments