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:
StringBuffer outputBuffer = new StringBuffer(length);
for (int i = 0; i < length; i++){
outputBuffer.append(" ");
}
return outputBuffer.toString();
Is there a better way to accomplish the same thing. In particular I'd like something that is fast (in terms of execution).