Checking empty string in Java
You could try :
if (str[i] == null || str[i].trim().equals("")){
// your code
}
You can use the Apache Commons Lang to check a String:
if (StringUtils.isBlank(str[i]) {
...
}
StringUtils.isBlank
is checking if the String is null
or empty (i.e. if it is equals to ""
when all blank characters are removed).