Here you can find the source of arrayOfDoubleToString(double[] array)
Parameter | Description |
---|---|
array | a parameter |
public static String arrayOfDoubleToString(double[] array)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w . j a v a 2 s. c o m * Provides a string representation for a given double array. * @param array * @return */ public static String arrayOfDoubleToString(double[] array) { StringBuilder sb = new StringBuilder(); sb.append("["); boolean firstIteration = true; for (int i = 0; i < array.length; ++i) { if (firstIteration) { firstIteration = false; } else { sb.append(","); } sb.append(String.format("%-3.3f", array[i])); } sb.append("]"); return sb.toString(); } }