Java Array Print printArray(Object[] array)

Here you can find the source of printArray(Object[] array)

Description

Prints the elements of the array, one per line, enclosed between *- and -*, except with the first line enclosed with 0- and -0.

License

Open Source License

Declaration

public static final void printArray(Object[] array) 

Method Source Code

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

public class Main {
    /**//from   www .j av  a  2  s .c  o m
     * Prints the elements of the array, one per line, enclosed between
     * *- and -*, except with the first line enclosed with 0- and -0.
     */
    public static final void printArray(Object[] array) {
        if (array == null) {
            System.out.println("null array");
            return;
        }
        if (array.length == 0) {
            System.out.println("zero-length array");
            return;
        }
        System.out.println("0-" + array[0].toString() + "-0");
        for (int i = 1; i < array.length; i++) {
            System.out.println("*-" + array[i].toString() + "-*");
        }
    }
}

Related

  1. printArray(int[] array, int start, int end)
  2. printArray(int[] nums)
  3. printArray(Object a[])
  4. printArray(Object[] arr)
  5. printArray(Object[] array)
  6. printArray(Object[] cells)
  7. printArray(Object[] o)
  8. printArray(Object[] strArray, String split)
  9. printArray(String arrayLabel, Object[] array)