Is there a way in java to create a string with a specified number of a specified character? In my case, I would need to create a string with 10 spaces. My current code is:
int c = 10; String spaces = String.format("%" +c+ "c", ' '); this will solve your problem.