Example

public class ClassA {
String s1;
String s2;
public void methodA() {

if (s1.indexOf(s2)>0){
// ...
}
}

}
Solution
When verifying the indexOf return value is greater than 0 then you are verifying that the argument string is contained in the caller string excluding the first character. As a result, if s1 is equal to s2 then the indexOf call will return 0. Most likely the test should be s1.indexOf(s2) >= 0.


public class ClassA {
String s1;
String s2;
public void methodA() {

if (s1.indexOf(s2)>=0){
// ...
}
}

}