```
public class Solution {
public int findMaxConsecutiveOnes(int[] nums) {
// the 1 is always included by 0
int start = -1; //record the start of 0
int end = 0;//record the end of 0
int max = 0; //record the max num of 1
while(start<nums.length && end<nums.length){
//find the 0
while(end<nums.length && nums[end]!=0){
end++;
}
if(end-start-1>max){
max = end-start-1;
}
start = end;
end++;
}
return max;
}
}
```