```
public int findMaxConsecutiveOnes(int[] nums) {
if(nums.length == 0) return 0;
int max = -1;
int i = 0;
int count = 0;
while(i < nums.length){
if(nums[i]!=1){
max = Math.max(max,count);
count = 0;
}
else{
count++;
}
i++;
}
return Math.max(count, max);
}
```