Avoid duplicate conditional checks in multiple boolean conditions
Why don't you just write it like this?  It should be logically equivalent.

if (id != null &amp;&amp; id &gt; 0 &amp;&amp; test.checkId(id) &amp;&amp; (isIdChanged || !isAjaxRequest))
{
    // do stuff
}




On a side note, I would move the null and positive id checks into your "checkId" method.  In fact, I think in this case, these checks are redundant and unnecessary.  You're just checking if an id is in an existing list that you're maintaining.  If it's null, it's unlikely it will exist in the list (if you are preventing arbitrary values from being added).  An id outside of the range of expected values will just not be in the list in the first place and therefore is unneeded as well.

But, if you must perform these checks, do it within the checkId method instead.

public boolean checkId(Long id)
{
    // we don't have null ids
    if (id == null)
        return false;
    // we're expecting positive ids
    if (id &lt;= 0)
        return false;

    return list.contains(id);
}


This reduces your outer condition to simply:

if (test.checkId(id) &amp;&amp; (isIdChanged || !isAjaxRequest))