Java - How to determine if there's a run of characters in an array? : Say we have an array: 

array = [1, 0, 0, 0, 1, 0, 1, 1, 1];

And we want to find a "run" of duplicate numbers where there are at least three in a row.  In this case, it would be the set of 0, 0, 0, and 1, 1, 1.

How can I determine which indices contain the "runs" of three or more?  I hope this makes sense.


