title: Java: Formatting error using printf
body: <p>I've searched around and could not find a precedent here for this particular issue. Cited, I've looked at the following questions. </p>
  
  <p><a href="https://stackoverflow.com/questions/20253762/using-printf-for-multiple-formats">using printf for multiple formats</a></p>
  
  <p><a href="https://stackoverflow.com/questions/8629995/formatting-using-printf-and-format">Formatting using printf and format</a> </p>
  
  <p><a href="https://stackoverflow.com/questions/25717224/formatting-problems-using-printf-in-java">Formatting problems using printf in java</a></p>
  
  <p>Below I'll outline the snippet of my code where I'm having problems. Please keep in mind I'm attempting to understand Efficiency outputs better and am exploring into why certain inputs cause there to be exponential, logarithmic, linear growth, etc etc. Anyways...</p>
  
  <pre><code>for (int i = 0; i &lt; 5; i++) {
       time = System.nanoTime();
       tl.timeTrial(N);
       elapsedTime = (System.nanoTime() - time) / BILLION;
       System.out.print(N + "\t");
       System.out.printf("%4.3f\t", elapsedTime);
       if (i != 0) {
          r = elapsedTime / previousTime;
          System.out.printf("%3.2\t", r);
          k = Math.log(r);
          System.out.printf("%3.2\n", k);
       }
       else {
          System.out.print("\n");
       }  
  
       previousTime = elapsedTime;
       N *= 2;
    }
  </code></pre>
  
  <p>From here I'll point out a few things.</p>
  
  <pre><code>System.out.printf("%4.3\t", elapsedTime);
  </code></pre>
  
  <p>compiles and runs perfectly. However, when I get into the if statement with r and k, I'm getting a run-time error and I do not for the life of me understand why. The error is as follows:</p>
  
  <pre><code>Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '4'
  at java.util.Formatter.checkText(Formatter.java:2579)
  at java.util.Formatter.parse(Formatter.java:2565)
  at java.util.Formatter.format(Formatter.java:2501)
  at java.io.PrintStream.format(PrintStream.java:970)
  at java.io.PrintStream.printf(PrintStream.java:871)
  at TimingLabClient.main(TimingLabClient.java:61)
  </code></pre>
  
  <p>Thank you for the help. Hopefully I won't get banned for asking a question I couldn't find an answer to again.</p>
  
  <p>Thank you. For those confused about my \t and \ns, it's helping with the output format, which doesn't necessarily have to be perfect.</p>
  
  <pre><code>N   Time(sec)   R   K
  8   0.723   
  16  5.760   7.964   2.075
  32  47.098  8.176   2.101
  </code></pre>
  
  <p>This program is actually going to run for about 7 hours...</p>