Java Array Output printArray(String lt, String[] arr, String rt)

Here you can find the source of printArray(String lt, String[] arr, String rt)

Description

print Array

License

Open Source License

Parameter

Parameter Description
lt a parameter
arr a parameter
rt a parameter

Declaration

public static void printArray(String lt, String[] arr, String rt) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from  www  .ja v a 2 s.c  o m*/
     * @param lt
     * @param arr
     * @param rt
     */
    public static void printArray(String lt, String[] arr, String rt) {
        if (arr.length < 1)
            System.out.println("[EMPTY]");
        else if (arr.length > 0) {
            for (int i = 0; i < arr.length; i++) {
                if (i < 9)
                    System.out.println(" " + (i + 1) + lt + arr[i] + rt);
                else
                    System.out.println("" + (i + 1) + lt + arr[i] + rt);
            }
        } else {
            for (int i = 0; i < arr.length; i++) {
                System.out.println(lt + arr[i] + rt);
            }
        }
    }

    /**
     * @param lt
     * @param arr
     * @param rt
     */
    public static void printArray(String lt, Object[] arr, String rt) {
        if (arr.length > 1) {
            for (int i = 0; i < arr.length; i++) {
                System.out.println(lt + arr[i] + rt);
            }
        } else {
            for (int i = 0; i < arr.length; i++) {
                System.out.println(lt + arr[i] + rt);
            }
        }
    }
}

Related

  1. printArray(int[][] num)
  2. printArray(Object array)
  3. printArray(Object[] arry, String specialText)
  4. printArray(Object[] data)
  5. printArray(Object[] in)
  6. printArray(String name, int[] array)
  7. printArray(T[] array)
  8. printArrayOfUnknownObjectsOnePerLine(Object[] array)