Here you can find the source of arrayToString2D(String title, String innerTitle, double[][] vect)
public static String arrayToString2D(String title, String innerTitle, double[][] vect)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { private static DecimalFormat decimalFormat; public static String arrayToString2D(String title, String innerTitle, double[][] vect) { String result = title + ": \n"; for (int i = 0; i < vect.length; i++) { result += printArray(innerTitle + " " + i, vect[i]) + "\n"; }//from w w w . j a v a 2 s.c om return result + "\n"; } public static String arrayToString2D(String title, double[][] vect) { String result = title + ": \n"; for (int i = 0; i < vect.length; i++) { result += arrayToString(vect[i]); } return result + "\n"; } public static String printArray(String title, double[] vect) { String result = title + ": "; result += arrayToString(vect); result += "\n"; return result; } public static String printArray(Object[] array, String separator) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { builder.append(array[i]); if (i < array.length + 1) builder.append(separator); } return builder.toString(); } public static String arrayToString(double[] vect) { String result = ""; for (int j = 0; j < vect.length; j++) { result += formatDouble(vect[j]); if (j + 1 < vect.length) result += " "; } return result; } public static String formatDouble(double d) { return decimalFormat.format(d); } }