Is there a feature that supports using a variable in the flag of javas printf method, for example
printf("%nd", 12);
where n is a variable?
I want to specify spacing outside of the printf method, for example
int n = 5;
System.out.printf("%nd", 12);
Instead of the following
System.out.printf("%5d", 12);
Alternatively, is there any built-in feature similar to that?