title: How to check if all array values but one are the same?
body: <p>I currently have the following array:</p>
  
  <pre><code>int[] gameState = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
  </code></pre>
  
  <p>I set 2 as "unplayed" on start and when a user does something, it calls a method and changes that array value to 1 like this:</p>
  
  <pre><code>int tappedCounter = Integer.parseInt(counter.getTag().toString());
  
      if (gameState[tappedCounter] == 2) {
  
          gameState[tappedCounter] = 1;
  </code></pre>
  
  <p>Now what I want to do is check after the users action if the array has one and one only different member and do something (output a text for example). </p>
  
  <p>So if the array is:</p>
  
  <pre><code>int[] gameState = {1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  </code></pre>
  
  <p>And the user does the above so one of these changes to one and the array becomes like this:</p>
  
  <pre><code>int[] gameState = {1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  </code></pre>
  
  <p>It should display the output.
  I doing this in Android Studio if that's important.</p>