private Double formatDoubleValue(Double value,int places){
  BigDecimal bd=new BigDecimal(value);
  bd=bd.setScale(places,RoundingMode.HALF_UP);
  return bd.doubleValue();
}

private Double formatDoubleValue ( Double value , int places ) { BigDecimal bd = new BigDecimal ( value ) ; bd = bd . setScale ( places , RoundingMode . HALF_UP ) ; return bd . doubleValue ( ) ; }
this function returns decimals value for a double
