```
public int findMaxConsecutiveOnes(int[] nums) {
int max = 0;
int a = -1, b = -1;
for(int i = 0; i <= nums.length; i++) {
if(i == nums.length || nums[i] == 0) {
max = Math.max(max, i - a - 1);
a = b;
b = i;
}
}
return max;
}
```