Don't use the same object operator == on reference types (line 42)
What happens if the player enters the same digit repeatedly, e.g. 000, 111 100, 666?
The usage of the == operator compares the reference variables rather than the content of the objects which are referenced by the reference variables. Let's consider s1 and s2, which are String objects created dynamically. Suppose that s1 = "hi" and s2 = "hi". In this scenario, s1 == s2 would returns false, since s1 and s2 are different variables. String.equals() should be used instead of ==. This is what i gathered after some reading.
If the winning number is 123 and the user enters 111, counter would be 3, which is wrong. I can see the logic error. Thanks. Campbell Richie!