Java Array to String getArrayAsString(double[] vals)

Here you can find the source of getArrayAsString(double[] vals)

Description

Convert an array of doubles to semi-colon separated values

License

Open Source License

Parameter

Parameter Description
vals is array of double

Return

an array of doubles to semi-colon separated values

Declaration

public static String getArrayAsString(double[] vals) 

Method Source Code


//package com.java2s;
/*/*  w w  w.j ava  2  s. co  m*/
 * Copyright (C) 2010-2014 Rotimi X Ojo, Andreas Maier
 * CONRAD is developed as an Open Source project under the GNU General Public License (GPL).
*/

import java.text.NumberFormat;

public class Main {
    /**
     * Convert an array of doubles to semi-colon separated values
     * @param vals is array of double
     * @return an array of doubles to semi-colon separated values
     */
    public static String getArrayAsString(double[] vals) {
        NumberFormat f = NumberFormat.getInstance();
        f.setGroupingUsed(false);
        String arrayString = "";
        for (int i = 0; i < vals.length; i++) {
            arrayString += f.format(vals[i]) + ";";
        }
        return arrayString.trim();
    }
}

Related

  1. convertByteToString(byte[] objectGuid)
  2. convertToString(String[] args)
  3. convertToString(String[] values, String separator)
  4. deepToString(Object[] a)
  5. encodedSeptetsToString(byte[] encodedSeptets)
  6. intArrayToString(int[] array, String delim)
  7. intArrayToString(int[] itemsPerPagines)
  8. intArrayToString(Object array)
  9. intToString(int[] vectorIndex)