Java Array arrayPrint(T[] x)

Here you can find the source of arrayPrint(T[] x)

Description

array Print

License

Open Source License

Declaration

public static <T> void arrayPrint(T[] x) 

Method Source Code

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

public class Main {
    public static <T> void arrayPrint(T[] x) {
        arrayPrint(x, "\n", true);
    }//from   ww  w. ja  v a 2 s.c  o m

    public static <T> void arrayPrint(T[] x, String separator) {
        arrayPrint(x, separator, false);
    }

    public static <T> void arrayPrint(T[] x, String separator, boolean finalSep) {
        T[] b = x;//arrayCopy(x);
        boolean first = true;
        for (int n = 0; n < b.length; n++) {
            if (first) {
                first = false;
            } else {
                System.out.print(separator);
            }
            T w = b[n];
            System.out.print(w);
        }
        if (finalSep) {
            System.out.print(separator);
        }
    }

    public static void arrayPrint(int[] x) {
        int[] b = x;//arrayCopy(x);
        for (int n = 0; n < b.length; n++) {
            int w = b[n];
            System.out.println(w);
        }
    }

    public static void arrayPrint(byte[] x) {
        byte[] b = x;//arrayCopy(x);
        for (int n = 0; n < b.length; n++) {
            byte w = b[n];
            System.out.println(w);
        }
    }

    public static void arrayPrint(char[] x) {
        char[] b = x;//arrayCopy(x);
        for (int n = 0; n < b.length; n++) {
            char w = b[n];
            System.out.println(w);
        }
    }
}

Related

  1. arrayOfClassType(T... array)
  2. arrayOffloatAsCSStrings(float[] ar)
  3. arrayOffloatCoordsAsCSStrings(float[] ar)
  4. arrayPrefixEqual(byte[] a1, int off1, byte[] a2, int off2, int len)
  5. arrayPrint(T[] arr)
  6. arrayPush(String[] array, String push)
  7. arrayRangeEquals(byte[] a, int aOffset, byte[] b, int bOffset, int byteCount)
  8. arrayRepresentsProbability(double[] probs)
  9. arraySame(Object[] array1, Object[] array2)