public static String format(double[] v,int w,int d){
  DecimalFormat format=new DecimalFormat();
  format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
  format.setMinimumIntegerDigits(1);
  format.setMaximumFractionDigits(d);
  format.setMinimumFractionDigits(d);
  format.setGroupingUsed(false);
  int width=w + 1;
  StringBuilder msg=new StringBuilder();
  msg.append('\n');
  for (int i=0; i < v.length; i++) {
    String s=format.format(v[i]);
    int padding=Math.max(1,width - s.length());
    for (int k=0; k < padding; k++) {
      msg.append(' ');
    }
    msg.append(s);
  }
  return msg.toString();
}

public static String format ( double [ ] v , int w , int d ) { DecimalFormat format = new DecimalFormat ( ) ; format . setDecimalFormatSymbols ( new DecimalFormatSymbols ( Locale . US ) ) ; format . setMinimumIntegerDigits ( 1 ) ; format . setMaximumFractionDigits ( d ) ; format . setMinimumFractionDigits ( d ) ; format . setGroupingUsed ( false ) ; int width = w + 1 ; StringBuilder msg = new StringBuilder ( ) ; msg . append ( '\n' ) ; for ( int i = 0 ; i < v . length ; i ++ ) { String s = format . format ( v [ i ] ) ; int padding = Math . max ( 1 , width - s . length ( ) ) ; for ( int k = 0 ; k < padding ; k ++ ) { msg . append ( ' ' ) ; } msg . append ( s ) ; } return msg . toString ( ) ; }
returns a string representation of this vector .
