I am trying to align some text on the right side like so:
String text = "whatever";
System.out.printf("%4s", text);
Except instead of the number 4 in the format scheme I want to use an integer variable, but I cannot find out how to do that. Please help.
What I tried:
int spaceCount = 4;
String text = "whatever";
System.out.printf("%{spaceCount}s", text);