code: public final static double roundToDecimals(double d, int c) {
  		if(c < 0) return d;
  		double p = Math.pow(10,c);
  		d = d * p;
  		double tmp = Math.round(d);
  		return tmp/p;
  	}
docs: Returns a value with the desired number of decimal places.
  
  @param d
  value to round
  @param c
  number of decimal places desired.
  Must be greater or equal to zero, otherwise, the given value d would be returned without any modification.
  @return
  a value with the given number of decimal places.