Code example for BigDecimal

Methods: doubleValue, setScale

0
//		   return big.doubleValue();  
		 return Double.parseDouble(str);
	} 
	 
	public static double round(double value, int scale, int roundingMode) {   
       BigDecimal bd = new BigDecimal(value + "");   
       bd = bd.setScale(scale, roundingMode);
       System.out.println("--------" + bd.doubleValue());
       double d = bd.doubleValue();   
       bd = null;   
       return d;   
   }    
	 
	public static void main(String[] args) {
	    double a = 33332569d;
	    System.out.println(round(a, 10, BigDecimal.ROUND_HALF_UP));
	    System.out.println(format(a));
    } 
}