Java Double Array to String doubleArrayToStringArray(final double[] line)

Here you can find the source of doubleArrayToStringArray(final double[] line)

Description

Converts an array of doubles into an array of Strings of those doubles.

License

Open Source License

Parameter

Parameter Description
line the array of doubles

Return

the array of strings

Declaration

public static String[] doubleArrayToStringArray(final double[] line) 

Method Source Code

//package com.java2s;
/*/*ww w . ja  v  a 2  s.  co m*/
 * Part of Simbrain--a java-based neural network kit
 * Copyright (C) 2005,2007 The Authors.  See http://www.simbrain.net/credits
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

public class Main {
    /**
     * Converts an array of doubles into an array of Strings of those doubles.
     *
     * @param line the array of doubles
     * @return the array of strings
     */
    public static String[] doubleArrayToStringArray(final double[] line) {
        String[] ret = new String[line.length];

        for (int i = 0; i < line.length; i++) {
            ret[i] = "" + line[i];
        }
        return ret;
    }
}

Related

  1. doubleArrayToString(double[] array)
  2. doubleArrayToString(double[] descriptor, char separator)