private static double round(double value,int nb){
  if (nb <= 0) {
    return Math.floor(value + 0.5d);
  }
  double p=Math.pow(10,nb);
  double tempval=Math.floor(value * p + 0.5d);
  return tempval / p;
}

private static double round ( double value , int nb ) { if ( nb <= 0 ) { return Math . floor ( value + 0.5d ) ; } double p = Math . pow ( 10 , nb ) ; double tempval = Math . floor ( value * p + 0.5d ) ; return tempval / p ; }
round a double value .
