Java Array to String array2String(double[] array)

Here you can find the source of array2String(double[] array)

Description

convert a double[] to a String "x[0],x[1],..."

License

Apache License

Parameter

Parameter Description
array a parameter

Declaration

public static String array2String(double[] array) 

Method Source Code

//package com.java2s;
/*/*from   w w w .ja  v a 2  s  . c  om*/
 * @(#)UtilFunc.java   
 *
 * Copyright (C) 2005-17 www.interpss.org
 *
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    
   http://www.apache.org/licenses/LICENSE-2.0
    
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 *
 * @Author Mike Zhou
 * @Version 1.0
 * @Date 04/7/2017
 * 
 *   Revision History
 *   ================
 *
 */

public class Main {
    /**
     * convert a double[] to a String "x[0],x[1],..."
     * 
     * @param array
     * @return
     */
    public static String array2String(double[] array) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < array.length; i++) {
            sb.append(String.valueOf(array[i]) + " ");
        }
        return sb.toString();

    }
}

Related

  1. array2displaystr(Object[] datas)
  2. array2String(E[] array)
  3. array2string(final T[] array, final int top)
  4. array2string(int[] _a)
  5. array2String(int[] paramArrayOfInt)