Checking whether if start and end has equal number of non-zero integers and contains 3 or more 0 in the center
You can determine the correct answer in a single pass, by working your way from the middle of the array outward, or from the ends of the array inward. Let's get started.

Although the problem description states to return 1 if the array is hollow  and 0 if it is not, such signature would make no sense in Java. It's only natural, and strongly recommended to use proper boolean true and false, respectively.

To work outward from the center, let's track left and right indexes.
If the array has odd number of elements,
left and right can both point to the middle element.
Otherwise the array has two central elements,
let's make left and right point at those.

int mid = nums.length / 2;
int left, right;
if (nums.length % 2 != 0) {
    left = right = mid;
} else {
    left = mid - 1;
    right = mid;
}


Now, let's start moving the left and right indexes outward, as long as both nums[left] and nums[right] are 0, and left &gt; 0.

while (left &gt; 0 &amp;&amp; nums[left] == 0 &amp;&amp; nums[right] == 0) {
    left--;
    right++;
}


The loop ends either when left reaches the second position of the array,
or when nums[left] or nums[right] (or both) are not zero.
If left and right were not moved enough, that is,
we haven't moved over enough zeros, then the array is not hollow and we can return.

if (right - left &lt; 4) {
    return false;
}


Finally, we need to verify that the rest of the elements are all non-zero.
We can do that by continuing to move outward, and aborting if any of the values is 0.

while (left &gt;= 0) {
    if (nums[left] == 0 || nums[right] == 0) {
        return false;
    }
    left--;
    right++;
}


When the loop completes without aborting, we know the array is hollow.

The complete solution, with some more test cases to verify it:

boolean isHollow(int... nums) {
    int mid = nums.length / 2;
    int left, right;
    if (nums.length % 2 == 0) {
        left = mid - 1;
        right = mid;
    } else {
        left = right = mid;
    }

    while (left &gt; 0 &amp;&amp; nums[left] == 0 &amp;&amp; nums[right] == 0) {
        left--;
        right++;
    }

    if (right - left &lt; 4) {
        return false;
    }

    while (left &gt;= 0) {
        if (nums[left] == 0 || nums[right] == 0) {
            return false;
        }
        left--;
        right++;
    }

    return true;
}

@Test
public void verify_isHollow() {
    assertThat(isHollow(1, 2, 4, 0, 0, 0, 3, 4, 5)).isTrue();
    assertThat(isHollow(1, 2, 4, 0, 0, 0, 1, 0, 3, 4, 5)).isFalse();
    assertThat(isHollow(1, 2, 0, 0, 0, 3, 4, 5)).isFalse();
    assertThat(isHollow(1, 2, 4, 9, 0, 0, 0, 3, 4, 5)).isFalse();
    assertThat(isHollow(1, 2, 0, 0, 3, 4)).isFalse();
    assertThat(isHollow(1, 2, 0, 0, 0, 0, 3, 4)).isTrue();
    assertThat(isHollow(1, 0, 0, 0, 3)).isTrue();
    assertThat(isHollow(1, 2, 0, 0, 0, 0, 3, 4, 5)).isFalse();
    assertThat(isHollow(1, 2, 1, 0, 0, 0, 0, 3, 4)).isFalse();
    assertThat(isHollow(0, 0, 0)).isFalse();
    assertThat(isHollow(0, 0, 0, 0, 0)).isFalse();
    assertThat(isHollow(0, 0, 0, 0, 0, 1)).isFalse();
    assertThat(isHollow(1, 0, 0, 0, 0, 0)).isFalse();
    assertThat(isHollow(1, 0, 0, 0, 0, 0, 2)).isTrue();
}