Unable to customize String format to print column-wise features
<p>I am trying to print the result of my computation into <code>JTextArea</code> in columns similar to table. I have three features (three columns) and I use the following <code>String format</code> solution that I found <a href="https://stackoverflow.com/questions/8533612/align-strings-in-columns-in-jtextarea">here</a> but it does not align them properly. Since I don't understand <code>"%1$5s %2$-40s %3$-20s";</code>, kindly can someone fix it?</p>

<pre><code>String format = "%1$5s %2$-40s %3$-20s";
for (int i = 0; i &lt; 10; i++) {
    String s = String.format(format, i*5, km.runningTime[i], km.DB[i]);
    jtextarea.append(s+ "\n");
}
</code></pre>