public static String formatPercent(double done,int digits){
  DecimalFormat percentFormat=new DecimalFormat("0.00%");
  double scale=Math.pow(10.0,digits + 2);
  double rounded=Math.floor(done * scale);
  percentFormat.setDecimalSeparatorAlwaysShown(false);
  percentFormat.setMinimumFractionDigits(digits);
  percentFormat.setMaximumFractionDigits(digits);
  return percentFormat.format(rounded / scale);
}

public static String formatPercent ( double done , int digits ) { DecimalFormat percentFormat = new DecimalFormat ( "0.00%" ) ; double scale = Math . pow ( 10.0 , digits + 2 ) ; double rounded = Math . floor ( done * scale ) ; percentFormat . setDecimalSeparatorAlwaysShown ( false ) ; percentFormat . setMinimumFractionDigits ( digits ) ; percentFormat . setMaximumFractionDigits ( digits ) ; return percentFormat . format ( rounded / scale ) ; }
format a percentage for presentation to the user .
