[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

one line to generate n spaces?

Is there a method in JDK 1.1.8 to construct a 
String of n spaces without using a loop?  

I've attempted to look in the API for it - 
String, StringBuffer, reflect.Array.

public static String padding(int n)
   StringBuffer b = new StringBuffer();

   for (int i=0; i<n; i++) b.append(' ');

   return b.toString();