title: Using parameter for specific width
body: <p>I want the second parameter in prettyInt to be the width in front of the first parameter. I do not know how to put a variable into a String.format at the %. Could someone help me?</p>
  <pre><code>public  class SomeFormats {
  
      public static void main (String[]args) {
          PrintWriter out = new PrintWriter (System.out);
          prettyInt(10, 30);
          out.flush();
      }
  
      public static String prettyInt(int n, int width) {
          int i = width;
          return String.format(&quot;%i %d&quot;, n);
      }
  }
  </code></pre>