title: How to fill in empty space with 0 using printf within Java
body: <p>How do I fill in the space of the first column in the following code with 0's?</p>
  
  <pre><code>for(int i = 0; i &lt; 10; i++) {
      System.out.printf("%-3.0f  %-1s%8.2f%1s %8.2f\n", (double)i, "[", 10d, "]", 10000d);
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>0    [   10.00] 10000.00
  1    [   10.00] 10000.00
  ...
  </code></pre>
  
  <p>Ouput I want</p>
  
  <pre><code>000  [   10.00] 10000.00
  001  [   10.00] 10000.00
  ...
  </code></pre>