Java Array Print printArray(double[] d)

Here you can find the source of printArray(double[] d)

Description

Prints out the array in the format "[1.0, 2.0, 3.0]"

License

Open Source License

Parameter

Parameter Description
d a parameter

Declaration

public final static void printArray(double[] d) 

Method Source Code

//package com.java2s;
/*/* w  w  w. jav a  2s  . c  o  m*/
 * ====================================================
 * Copyright (C) 2013 by Idylwood Technologies, LLC. All rights reserved.
 *
 * Developed at Idylwood Technologies, LLC.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * The License should have been distributed to you with the source tree.
 * If not, it can be found 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: Charles Cooper
 * Date: 2013
 * ====================================================
 */

public class Main {
    /**
     * Prints out the array in the format "[1.0, 2.0, 3.0]"
     * @param d
     */
    public final static void printArray(double[] d) {
        System.out.print("[");
        for (int i = 0; i < d.length; ++i) {
            if (0 != i)
                System.out.print(",");
            System.out.print(d[i]);
        }
        System.out.println("]");
    }
}

Related

  1. printArray(double[] _a)
  2. printArray(double[] _a)
  3. printArray(double[] a)
  4. printArray(double[] a)
  5. printArray(double[] array, String info)
  6. printArray(E[] a)
  7. printArray(float[] array)
  8. printArray(float[] spectrum)
  9. printArray(int A[])