Here you can find the source of formatDoubleArray(double[] arr, String format)
public static String formatDoubleArray(double[] arr, String format)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { public static String formatDoubleArray(double[] arr, String format) { DecimalFormat fmt = new DecimalFormat(format); StringBuilder sb = new StringBuilder(); sb.append("["); for (int i = 0; i < arr.length; i++) { if (i > 0) { sb.append(", "); }//from w w w. jav a2s . c o m sb.append(fmt.format(arr[i])); } sb.append("]"); return sb.toString(); } }