Since Java 1.5 we can use the
method java.lang.String.format(String
, object) and use printf like format.
The
format string "%1$15s" will
do the job. Where 1$ indicates the
argument index, s indicates that
the argument is a String 15 represent the
minimal width of the String. Putting it all together: "%1$15s". read more