SyntaxFix
Write A Post
Hire A Developer
Questions
If you want only spaces, then how about:
String spaces = (n==0)?"":String.format("%"+n+"s", "");
which will result in abs(n) spaces;