A series of possible values
<p>I want to make an If statement:</p>

<pre><code>if(x == y+n)

{ }

n = [-20...20]
</code></pre>

<p>where n can be any integer value from -20 to 20.</p>

<p>How to do this in java?</p>

<p>In android I am trying to "synchronize" the ontouch listener to drawView. So I mean an image randomly appears I want to perform a certain action when the image appears....So the "touch" on the screen is pretty precise... </p>

<pre><code>----DrawView Class---

setX(rand.nextInt(width-20));
setY(rand.nextInt(height-20));
canvas.drawBitmap(b, getX(), getY(), paint);


public boolean onTouch(View arg0, MotionEvent event) {
if (event.getX() == DrawView.getX()|| event.getY() == DrawView.getY())
{
Certian action...
} 
}
</code></pre>

<p>so how can I include, DrawView.getX()+[-20...20] and DrawView.getY()+[-20...20]?</p>
