I don't think I can use charAt(i) to compare the three consecutive 1's, but I don't know what I can use to test if there are three consecutive 1's in the string.
You could use charAt() but it is tedious to do so compared to using contains().
Note that the test input.charAt(i) == '111'
is not valid since '111'
is not a valid character literal.
To test if your bit String contains at least three consecutive ones somewhere in the String, you can use input.contains("111")
.