Check values with tolerance
<p>I am trying to check whether one value equals + or - 2 the other value.</p>

<p>This is what i have come across.</p>

<pre><code>    for (int lineNumber : errorLineList) {
        if (lineNumber == startLineNumber
                || lineNumber == (startLineNumber + 1)
                || lineNumber == (startLineNumber + 2)
                || lineNumber == (startLineNumber - 1)
                || lineNumber == (startLineNumber - 2)) {
            lineFound = true;
            break;
        }
    }
</code></pre>

<p>But here if i want the tolerance to be 5, then i have to add 10 checks.</p>

<p>Is there any other elegant way to do this in java.</p>
