Here you can find the source of toString(Double[] input)
public static String toString(Double[] input)
//package com.java2s; /****//from ww w . j ava2 s.c o m activequant - activestocks.eu This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. contact : contact@activestocks.eu homepage : http://www.activestocks.eu ****/ import java.text.DecimalFormat; public class Main { private static DecimalFormat dcf = new DecimalFormat("#.########"); public static String toString(Double[] input) { StringBuilder ret = new StringBuilder(); for (Double o : input) { ret.append(""); if (o != null) ret.append("" + dcf.format(o)); else ret.append("NULL"); ret.append(" "); } return ret.toString(); } public static String toString(double[] input) { StringBuilder ret = new StringBuilder(); for (double o : input) { ret.append(dcf.format(o)); ret.append(", "); } ret.delete(ret.length() - 2, ret.length()); return ret.toString(); } public static String toString(String[] input) { StringBuilder ret = new StringBuilder(); for (String o : input) { ret.append(o); ret.append(", "); } if (ret.length() > 2) ret.delete(ret.length() - 2, ret.length()); return ret.toString(); } public static String toString(Double[][] input) { StringBuilder ret = new StringBuilder(); for (Double[] o : input) { ret.append(toString(o)); ret.append("\n"); } return ret.toString(); } }