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:
How about this?
char[] bytes = new char[length]; Arrays.fill(bytes, ' '); String str = new String(bytes);