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