title: Java DecimalFormat Scientific Notation Question
body: <p>I'm using Java's <a href="https://stackoverflow.com/questions/168802/where-can-i-find-a-tutorial-to-get-started-learning-jquery">DecimalFormat</a> class to print out numbers in Scientific Notation.  However, there is one problem that I have.  I need the strings to be of fixed length regardless of the value, and the sign on the power of ten is throwing it off.  Currently, this is what my format looks like:</p>
  
  <pre><code>DecimalFormat format = new DecimalFormat("0.0E0");
  </code></pre>
  
  <p>This gives me the following combinations: 1.0E1, 1.0E-1, -1.0E1, and -1.0E-1.</p>
  
  <p>I can use <em>setPositivePrefix</em> to get: +1.0E1, +1.0E-1, -1.0E1, and -1.0E-1, or whatever I like, but it doesn't affect the sign of the power!</p>
  
  <p>Is there any way to do this so that I can have fixed length strings?  Thanks!</p>
  
  <p>Edit: Ah, so there's no way to do it using Java's existing <em>DecimalFormat</em> API?  Thanks for the suggestions!  I think I may have to subclass <em>DecimalFormat</em> because I am limited by the interface that is already in place.</p>