```
public class Solution {
public int findMaxConsecutiveOnes(int[] nums) {
int maxLength = 0;
int length = 0;
for(int i = 0; i < nums.length; i++) {
if(nums[i] == 0) {
maxLength = Math.max(length, maxLength);
length = 0;
} else {
length ++;
}
}
maxLength = Math.max(length, maxLength);
return maxLength;
}
}```
```