```
public int findMaxConsecutiveOnes(int[] nums) {
int maxHere = 0, max = 0;
for (int n : nums)
max = Math.max(max, maxHere = n == 0 ? 0 : maxHere + 1);
return max;
}
```

The idea is to reset `maxHere`

to 0 if we see 0, otherwise increase `maxHere`

by 1

The max of all `maxHere`

is the solution

```
110111
^ maxHere = 1
110111
.^ maxHere = 2
110111
..^ maxHere = 0
110111
...^ maxHere = 1
110111
....^ maxHere = 2
110111
.....^ maxHere = 3
```

We can also solve this problem by setting `k = 0`

of Max Consecutive Ones II