Java Array Create array(int[] array, int index)

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

Description

array

License

Open Source License

Declaration

public static String array(int[] array, int index) 

Method Source Code

//package com.java2s;

public class Main {
    private static final String EMPTY = "";
    private static final String CHECKED = "checked";

    public static String array(int[] array, int index) {
        if ((array == null) || (index >= array.length) || (index < 0)) {
            return EMPTY;
        }/* ww w. j  a v a 2 s  .c  om*/
        return (array[index] != 0) ? CHECKED : EMPTY;
    }

    public static String array(long[] array, int index) {
        if ((array == null) || (index >= array.length) || (index < 0)) {
            return EMPTY;
        }
        return (array[index] != 0) ? CHECKED : EMPTY;
    }

    public static String array(float[] array, int index) {
        if ((array == null) || (index >= array.length) || (index < 0)) {
            return EMPTY;
        }
        return (array[index] != 0) ? CHECKED : EMPTY;
    }

    public static String array(double[] array, int index) {
        if ((array == null) || (index >= array.length) || (index < 0)) {
            return EMPTY;
        }
        return (array[index] != 0) ? CHECKED : EMPTY;
    }
}

Related

  1. array(CharSequence... args)
  2. array(final T... array)
  3. array(final T... elements)
  4. array(int... rest)
  5. array(int... values)
  6. array(Object... objects)
  7. array(Object... val)
  8. array(String str)
  9. array(String... strings)