Java Array Print printArray(double[] a)

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

Description

print array of values in one line

License

Open Source License

Parameter

Parameter Description
a a parameter

Declaration

public static void printArray(double[] a) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//w  w  w .j ava  2  s  . c  o m
     * print array of values in one line
     * @param a
     */
    public static void printArray(double[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.format("%.2f  ", a[i]);
        }
        System.out.println();
    }

    public static void printArray(float[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.format("%.2f  ", a[i]);
        }
        System.out.println();
    }

    public static void printArray(String[] a) {
        printArray(a, " ");
    }

    /**
     * print array of values in one line
     * @param a
     */
    public static void printArray(String[] a, String sep) {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + sep);
        }
        System.out.println();
    }
}

Related

  1. print(String[] files)
  2. print1DIntArray(int[] array)
  3. printArray(boolean[] array)
  4. printArray(double[] _a)
  5. printArray(double[] _a)
  6. printArray(double[] a)
  7. printArray(double[] array, String info)
  8. printArray(double[] d)
  9. printArray(E[] a)