Then either s or check have a value you do not expect. Use a println to see the values of both variables just before your if statement and see which one (or if both) have the value you expect.