I have lots of multiple if-else statements. For code optimization, I need to write one function for all if else logic. As of now my code structure is in below.

input request is in JSONObject(org.json.simple.JSONObject), which have more than 10 values.

```
  String s = (String) inputObj.get("test");
  String s1 = (String) inputObj.get("test");
  String s2 = (String) inputObj.get("test");
  String s3 = (String) inputObj.get("test");
        if (s != null && s.trim().isEmpty()) {
            if (s1 != null && s1.trim().isEmpty()) {
                if (s2 != null && s2.trim().isEmpty()) {
                    if (s3 != null && s3.trim().isEmpty()) {
                        if (s4 != null && s4.trim().isEmpty()) {
                           ........
                        } else {
                          return;
                        }
                    } else {
                        return;
                    }
                } else {
                     return;
                }
            } else {
               return;
            }
        } else {
           return;
        }

```

How to avoid this kind of looping and throw an error message in common method.

Advance thanks.