public static double round(double number,int nDigits){
  return (double)Math.round(number * Math.pow(10,nDigits)) / Math.pow(10,nDigits);
}

public static double round ( double number , int nDigits ) { return ( double ) Math . round ( number * Math . pow ( 10 , nDigits ) ) / Math . pow ( 10 , nDigits ) ; }
return the double value number rounded to ndigits digits after the decimal point . if ndigits is omitted , it defaults to zero . the result is a double .
