title: Format of BigDecimal number
body: <pre><code>BigDecimal val = BigDecimal.valueOf(0.20);
  System.out.println(a);
  </code></pre>
  
  <p>I want to store in val a value <code>0.20</code> and not <code>0.2</code>. What I can do ?</p>
  
  <p>I dont think I can use <code>NumberFormat</code> in this case, when I use <code>NumberFormat</code> I must know what the length of my decimal number is! I can have 0.20 or 0.5000, I don't know the exact length of my decimal number, so I cannot use :</p>
  
  <pre><code>DecimalFormat df = new DecimalFormat("#0.00");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>DecimalFormat df = new DecimalFormat("#0.00000");
  </code></pre>
  
  <p>maybe I have just 2 numbers after point or 5 numbers or more, and this program doesn't work:</p>
  
  <pre><code> BigDecimal a = BigDecimal.valueOf(0.20);//i give an example of 0.2 i can have 0.98...0
           System.out.println(a);
  
           NumberFormat nf1 = NumberFormat.getInstance();
           System.out.println(nf1.format(0.5000));
  </code></pre>