public static double round(double a,double precision){
  if (precision == 0.0) {
    return 0.0;
  }
  return Math.round(a / precision) * precision;
}

public static double round ( double a , double precision ) { if ( precision == 0.0 ) { return 0.0 ; } return Math . round ( a / precision ) * precision ; }
mathematically rounds a number with a defined precision .
