```
public int findMaxConsecutiveOnes(int[] nums) {
int maxSum = 0;
int index_0 = 0;
for (int i = 0; i < nums.length; i++) {
if (nums[i] == 0) {
index_0 = i + 1;
}
maxSum = Math.max(i + 1 - index_0, maxSum);
}
return maxSum;
}
```