title: Java: Print a 2D String array as a right-justified table
body: <p>What is the <em>best</em> way to print the cells of a <code>String[][]</code> array as a right-justified table? For example, the input</p>
  
  <pre><code>{ { "x", "xxx" }, { "yyy", "y" }, { "zz", "zz" } }
  </code></pre>
  
  <p>should yield the output</p>
  
  <pre><code>  x xxx
  yyy   y
   zz  zz
  </code></pre>
  
  <p>This seems like something that one <em>should</em> be able to accomplish using <code>java.util.Formatter</code>, but it doesn't seem to allow non-constant field widths. The best answer will use some standard method for padding the table cells, not the manual insertion of space characters.</p>