public static double roundDouble(double value,int afterDecimalPoint){
  double mask=Math.pow(10.0,afterDecimalPoint);
  return (Math.round(value * mask)) / mask;
}

public static double roundDouble ( double value , int afterDecimalPoint ) { double mask = Math . pow ( 10.0 , afterDecimalPoint ) ; return ( Math . round ( value * mask ) ) / mask ; }
rounds a double to the given number of decimal places .
