Without actual code:
- iterate thorough the array
- count the 1s you found
- if you found a 0 then start over the count
- check after increasing the counter: if the counter reaches 3 then return with
true
- if you reached the end of the array and no more elements then return with
false
Something like this, I hope I could help.
solved Arraylist index calculation java [closed]