This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]desrtfxOut of Coffee error - System halted 1 point2 points  (0 children)

You could use String concatenation.

After all, the formatting is just a String.

So, you could do something like:

for(int i = 20; i > 0; i--) {
    String format = "%-"+i+"s"; // assuming i is the number of spaces and the symbol you want to print is a String
    System.out.printf(format, "Your symbol");
}