```
public class Solution {
public int findMaxConsecutiveOnes(int[] nums) {
int len = nums.length;
int prevIndex = -1;
int maxLength = Integer.MIN_VALUE;
for (int i = 0; i < len; i++) {
if (nums[i] == 0) {
int diff = i - prevIndex -1;
maxLength = Math.max(maxLength, diff);
prevIndex = i;
}
}
maxLength = Math.max(maxLength, len - prevIndex - 1);
return maxLength;
}
}
```