title: Java printf not printing doubles right
body: <p>I'm trying to format my decimal output so that it cuts/rounds decimals so that they only have four digits; Two in front and two in back.</p>
  
  <pre><code>for (int i = 0; i &lt; planets.length; i++) {
          System.out.print(planets[i]);
          System.out.printf("     %4.2f", planetDiameter[i]);
          System.out.printf("     %4.2f", planetMass[i]);
          System.out.printf("     %4.2f\n", gravity[i]);
      }
  </code></pre>
  
  <p>But this doesn't cut or round the front of the decimal at all. Is there a way to shorten the front part of the decimal so that I don't get a large number?</p>