Use the string class’s constructor to specify the character and the number of times you want it to be repeated.
Listing 1. Repeat String Characters
String repeatedCharacterString = new String('*',50);
The sample code will create a string of 50 repeated ‘*’ characters.