Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;

public class Main {
    public static int indexOfSubArray(final int[][] array, final int[] subArray) {
        if (!isEmpty(array) && !isEmpty(subArray)) {
            for (int i = 0; i < array.length; i++) {
                if (Arrays.equals(array[i], subArray)) {
                    return i;
                }
            }
        }

        return -1;
    }

    public static boolean isEmpty(final boolean[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final byte[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final int[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final long[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final float[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(final double[] array) {
        return array == null || array.length == 0;
    }

    public static <T> boolean isEmpty(final T[] array) {
        return array == null || array.length == 0;
    }
}