This example will show how to repeat a string for a given number of times using java, guava and apache commons.
Straight up Java
Char array
For loop
With each iteration of a for loop we will append to a StringBuilder a specified number of times repeating a string.
Google Guava
Guava Strings.repeat will concatenate an input String a specific number of times.
Apache Commons
Apache commons will repeat a String a specified number of times to form a new String.