find the index of subarray from a parent array
Advice 1

Your method is a little bit overdone. Consider this:

public static int getSubArrayIndexV2(int[] haystack, int[] needle) {
    outer:
    for (int i = 0; i &lt;= haystack.length - needle.length; ++i) {
        for (int j = 0; j &lt; needle.length; ++j) {
            if (haystack[i + j] != needle[j]) {
                continue outer;
            }
        }

        return i;
    }

    return -1;
}


Advice 2

This is actually pattern matching in "strings" consisting of integers instead of characters. As such, you can use, say, Knuth-Morris-Pratt algorithm that runs in time \$\mathcal{O}(n + m)\$ (where \$n\$ is the length of the integer array to search in, and \$m\$ is the length of the integer array to search for). The complexity of your solution is worst-case \$\mathcal{O}(nm)\$.

(Take a look at this program.)