Declare an extra variable before using printf:
String format = "%" + fieldSize + "d";
System.out.printf(format, yourVariables);
(this is the first solution I found from a web search)
Declare an extra variable before using printf:
String format = "%" + fieldSize + "d";
System.out.printf(format, yourVariables);
(this is the first solution I found from a web search)