title: add leading zeros dynamically relative to input number
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/473282/left-padding-integers-with-zeros-in-java">Left padding integers with zeros in Java</a>  </p>
  </blockquote>
  
  
  
  <p>I need to add some leading zeros dynamically relative to input number length, for example if I input 10 the it will output </p>
  
  <p>Numbers
  01
  02
  03
  04
  05
  06
  07
  08
  09
  10</p>
  
  <p>I think the way to do it is to get the length of the numbers input and then apply that value to the counter using some formatting, just not sure the best way of going about that.</p>
  
  <p>This is what I have so far.. (I am very new to programming)</p>
  
  <pre><code>    public static void main(String[] args) {
      int numbers;
      int counter = 1;
      int padlength;
  
      Scanner ngrabber = new Scanner(System.in);
      System.out.println("Please enter numbers to output number");
      numbers = ngrabber.nextInt();
  
  
                  System.out.println("Numbers");
                  while (counter &lt;= numbers)          
                  {
                      padlength = String.valueOf(numbers).length();
                      System.out.println(counter);
                      counter++;
                  }
  
  
          }       
      }   
  </code></pre>