That problem is closely related to finding the maximum number within an array. It can be done sequentially in O(n) time where n is proportional to length of array.
This method wasn't tested by compiling and running but it might work and is definitely close to what you want:
int getLengthOfMaximumSequenceOfZeros(int a[])
{
int maxLen=0;
int curLen=0;
// loop through all elements in the array.
for (int i=0;i<a.length;i++)
{
if (a[i]==0)
{
curLen++; // sequence is getting longer by 1.
}
else // restarting new sequence of zeros
{
// if the sequence ending is longer, remember its length.
if (curLen>maxLen)
maxLen = curLen;
curLen=0; // current sequence has length 0 again.
}
}
// if longest sequence goes right to the end of array
if (curLen>maxLen)
maxLen = curLen;
return maxLen;
}