private static double round(double value,int decimalPlaces){
  return Math.round(value * Math.pow(10,decimalPlaces)) / Math.pow(10,decimalPlaces);
}

private static double round ( double value , int decimalPlaces ) { return Math . round ( value * Math . pow ( 10 , decimalPlaces ) ) / Math . pow ( 10 , decimalPlaces ) ; }
rounds a decimal value to the given decimal place .
