title: Java - always keep two decimal places even in zeroes
body: <p>I am trying to keep two decimal places, even if then numbers are zeroes, using <code>DecimalFormatter</code>:</p>
  
  <pre><code>DecimalFormat df = new DecimalFormat("#.00");
  
  m_interest   = Double.valueOf(df.format(m_principal * m_interestRate));
  m_newBalance = Double.valueOf(df.format(m_principal + m_interest - m_payment));
  m_principal  = Double.valueOf(df.format(m_newBalance));
  </code></pre>
  
  <p>However for some values this gives two decimal places, and for others it doesnt. How can i fix this?</p>