Null pointer exception when proving min heap in a binary tree
<p>This code is to find out if the binary tree is min heap or not, I keep getting a <code>NullPointerException</code> at the 3rd if statement in public static boolean isMinHeap, I am unsure as to why I keep getting this exception since I thought the code would be valid due to the above break.</p>

<pre><code>public class ArrayHeapChecker {
public static boolean isBinaryTree(Integer[] array) {
    for (int i = 1; i &lt; array.length; i++){
        if (array[i] != null &amp;&amp; array [(i-1)/ 2] == null)   {
            return false;
        }
    }
    return true;
}
public static boolean isCompleteBinaryTree(Integer[] array) {
    if(!isBinaryTree(array)) {
        return false;
    }

    for (int i = 0; i &lt; array.length - 1; i++)  {
        if ((i % 2 == 0) &amp;&amp; array[i] == null &amp;&amp; array[i + 1] != null)   {
            return false;
        }
        if ((i % 2 != 0) &amp;&amp; array[i] == null &amp;&amp; array[i + 1] != null)   {
            return false;
        }
    }

    return true;
}
public static boolean isMinHeap(Integer[] array) {
    if(!isCompleteBinaryTree(array)) {
        return false;
    }
    for (int i = 0; i &lt; array.length - 1; i++)  {
        if (array[i] == null)   {
            break;
        }
        if (array.length &lt;= ((2*i) + 2))    {
            break;
        }
        if (array[(i * 2) + 1] == null || array[(i * 2) + 2] == null)   {
            break;
        }
        if (array[i] &gt; array[(i * 2) + 1] || array[i] &gt; array[(i * 2) + 2]) {
            return false;
        }
    }
    return true;
}
}
</code></pre>