Java Fraction Format formatDoubleArray(double[] arr, String format)

Here you can find the source of formatDoubleArray(double[] arr, String format)

Description

format Double Array

License

Open Source License

Declaration

public static String formatDoubleArray(double[] arr, String format) 

Method Source Code

//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();
    }
}

Related

  1. formatDouble(double value, int precision)
  2. FormatDouble(final double dblValue, final int iNumLeft, final int iNumRight, final double dblMultiplier)
  3. formatDouble(Object obj)
  4. formatDouble(Object value)
  5. formatDoubleAmount(double amount)
  6. formatDoubleAsPointsString(Double d)
  7. formatDoubleAsString(Double val)
  8. formatDoubleDecimal(float in)
  9. formatDoubleDecPoint2(Double value)