public String createPatternString ( String pattern , int length ) { if ( pattern == null ) { return null ; } int totalLength = pattern . length ( ) * length ; StringBuffer sb = new StringBuffer ( totalLength ) ; for ( int i = 0 ; i < length ; i ++ ) { sb . append ( pattern ) ; } return sb . toString ( ) ; }
Creates a String with the specified pattern repeated length times .