code: public static StringBuilder formatTo(StringBuilder buf, double[][] d, String pre, String pos, String csep, NumberFormat nf) {
      if(d == null) {
        return buf.append("null");
      }
      if(d.length == 0) {
        return buf;
      }
      for(int i = 0; i < d.length; i++) {
        formatTo(buf.append(pre), d[i], csep, nf).append(pos);
      }
      return buf;
    }
docs: Formats the array of double arrays d with the specified separators and
  fraction digits.
  
  @param buf Output buffer
  @param d the double array to be formatted
  @param pre Row prefix (e.g. " [")
  @param pos Row postfix (e.g. "]\n")
  @param csep Separator for columns (e.g. ", ")
  @param nf the number format to use
  @return Output buffer buf