public float round(float d,int decimalPlace){
  BigDecimal bd=new BigDecimal(Float.toString(d));
  bd=bd.setScale(decimalPlace,BigDecimal.ROUND_HALF_UP);
  return bd.floatValue();
}

public float round ( float d , int decimalPlace ) { BigDecimal bd = new BigDecimal ( Float . toString ( d ) ) ; bd = bd . setScale ( decimalPlace , BigDecimal . ROUND_HALF_UP ) ; return bd . floatValue ( ) ; }
round to certain number of decimals
