public static String createString ( final char charToRepeat , int numberOfRepeats ) { assert numberOfRepeats >= 0 ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < numberOfRepeats ; ++ i ) { sb . append ( charToRepeat ) ; } return sb . toString ( ) ; }
Create a new string containing the specified character repeated a specific number of times .