title: printf to append blank spaces to the end of a string
body: <p>In Java is there any way to use printf to add spaces to the end of a string to ensure all strings are the same length in the command line. </p>
  
  <p>I have a program which returns records but I need to display them as so...</p>
  
  <pre><code> Bob          27     007895
   Christopher  32     007856
  </code></pre>
  
  <p>Essentially I want each name to take up 30 characters so the columns all align. At the moment I.m using a tab at the end of the string to create the columns but there are some names which cause all the columns to miss align (Christopher is one of them).... So im assuming there is a much better way to do this?</p>
  
  <pre><code>System.out.print(Bob.getName() + "\t");
  System.out.print(Bob.getAge() + "\t");
  Sstem.out.print(Bob.getRegnumber() + "\t");
  System.out.print(Chris.getName() + "\t");
  System.out.print(Chris.getAge() + "\t");
  Sstem.out.print(Chris.getRegnumber() + "\t");
  </code></pre>
  
  <p>I'm outputting to the comandline not using a GUI. </p>
  
  <p>Cheers</p>