Android ArrayList values
<p>I have an int n which chooses a random number. Each time I save n in arraylist array. Now I want to compare that if int n is equal to two last random numbers. For example if we have      <code>2 - 3 - 5- 3</code> , it should choose 3 as a repeated int. Should I compare it them like this?      </p>

<pre><code>if(n == array.size()-2) { 
}
</code></pre>

<p>It doesn't work like this. Where is the problem?</p>
