public int findMaxConsecutiveOnes(int[] nums) {

if(nums == null || nums.length == 0) return 0;

//int start = 0;

int max = 0;

for(int i = 0; i < nums.length; i++) {

if(nums[i] == 1) {

// find the consecutive 1

int j = i;

int len = 0;

while(j < nums.length && nums[j] != 0) {

len++;

j++;

}

max = Math.max(max, len);

}

}

return max;

}