title: DecimalFormat pattern
body: <pre><code>public static String formatAmountUpToTwoDecimalNumber(String amount)
      {       
          if(amount==null || "".equals(amount))
          {
               return "";
          }  
          Double doubleAmount = Double.valueOf(amount);
          double myAmount = doubleAmount.doubleValue();
          NumberFormat f = new DecimalFormat("###,###,###,###,##0.00");
          String s = f.format(myAmount);
          return s;
      }
  </code></pre>
  
  <p><code>"###,###,###,###,##0.00"</code>, What exactly is the purpose of this pattern ? I believe it serves two purposes</p>
  
  <ol>
  <li>to group numbers, that is put thousand seperator comma</li>
  <li>to append two zeros after decimal if decimal is missing that is convert 23 to 23.00</li>
  </ol>
  
  <p>But why there is <code>"0"</code> instead of <code>"#"</code> before decimal? what exactly is the purpose of this zero?
  Thanks for the help. </p>