this is my code and I don't know why "one == null" and "two == null" are always False and I can't send any Null argument to my method! please help me
public class RepeatInString {
public int StringInString(String one, String two) {
if (one.equals("") || two.equals("") || one == null || two == null){
return 0;
}
else{
char[] oneChar = one.toCharArray();
char[] twoChar = two.toCharArray();
int repeatCounter = 0;
int matchChars = 0;
for (int i=0 ; i < (one.length()-two.length()+1) ;i++ ){
matchChars = 0;
for (int j=0; j<two.length() ;j++) {
if (oneChar[i + j] == twoChar[j])
matchChars += 1;
else
break;
}
if (matchChars == two.length())
repeatCounter += 1;
}
return repeatCounter;
}
}