code: public static String format(double[][] m, String pre) {
      StringBuilder output = new StringBuilder() //
          .append(pre).append("[\n").append(pre);
      for(int i = 0; i < m.length; i++) {
        formatTo(output.append(" ["), m[i], ", ").append("]\n").append(pre);
      }
      return output.append("]\n").toString();
    }
docs: Returns a string representation of this matrix. In each line the specified
  String <code>pre</code> is prefixed.
  
  @param pre the prefix of each line
  @return a string representation of this matrix