title: setting decimal places to a float value
body: <pre><code>float a= (float) 1846.4;
  
  NumberFormat df = DecimalFormat.getInstance();
  df.setMinimumFractionDigits(2);
  df.setMaximumFractionDigits(2);
  
  float b = Float.parseFloat( df.format(a));
  </code></pre>
  
  <p>What would be the best way to set decimal places for a float (I just want to set 2 decimal places of a float value which can be 2013.43452 or 2392.2) ? Now I am getting exception like E<code>xception in thread "main" java.lang.NumberFormatException: For input string: "1,846.40"</code>.</p>