Java Array Print print1DIntArray(int[] array)

Here you can find the source of print1DIntArray(int[] array)

Description

print D Int Array

License

Open Source License

Declaration

public static void print1DIntArray(int[] array) 

Method Source Code

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

import java.util.Arrays;

public class Main {
    public static void print1DIntArray(int[] array) {
        printArray(getBoxedIntArray(array));
    }//from w w  w  .ja va2 s. co m

    public static <T> void printArray(T[] array) {
        int len = array.length;
        System.out.print("[");
        for (int i = 0; i < len; i++) {
            if (i != len - 1) {
                System.out.print(array[i] + ", ");
            } else {
                System.out.println(array[i] + "]");
            }
        }
    }

    public static Object[] getBoxedIntArray(int[] nums) {
        if (nums == null) {
            return null;
        }
        return Arrays.stream(nums).boxed().toArray();
    }
}

Related

  1. formatStringForPrettyPrintingRelatedValues(double[] values, int minDigits)
  2. prettyPrint(double[][] gammas, double[][] thetas, double[][] zprobs)
  3. print(Object[] array)
  4. print(Object[] array)
  5. print(String[] files)
  6. printArray(boolean[] array)
  7. printArray(double[] _a)
  8. printArray(double[] _a)
  9. printArray(double[] a)