public static void formatDouble(double source,int decimals,int precision,StringBuffer target){
  int scale=(Math.abs(source) >= 1.0) ? decimals : precision;
  if (tooManyDigitsUsed(source,scale) || tooCloseToRound(source,scale)) {
    formatDoublePrecise(source,decimals,precision,target);
  }
 else {
    formatDoubleFast(source,decimals,precision,target);
  }
}

public static void formatDouble ( double source , int decimals , int precision , StringBuffer target ) { int scale = ( Math . abs ( source ) >= 1.0 ) ? decimals : precision ; if ( tooManyDigitsUsed ( source , scale ) || tooCloseToRound ( source , scale ) ) { formatDoublePrecise ( source , decimals , precision , target ) ; } else { formatDoubleFast ( source , decimals , precision , target ) ; } }
rounds the given source value at the given precision and writes the rounded value into the given target
