title: How to find if an element exists within a character array in java
body: <p>Here is the thing. I have a character array as follows..</p>
  
  <pre><code>char[] modes = new char[] { 'm', 'q', 'h', 'y' };
  </code></pre>
  
  <p>Now I want to provide the user with the option to enter a character. If it exists in the <code>modes</code> array, I'll do the necessary. For that I used...</p>
  
  <pre><code>//to take a character as input
  mode = input.next().charAt(0);
  //now to check if the array contains the character
  boolean ifExists = Arrays.asList(modes).contains(mode);
  </code></pre>
  
  <p>But strangely <code>ifExists</code> returns <code>false</code>. </p>
  
  <ol>
  <li>Any Ideas where am I doing wrong?</li>
  <li>If this is a bad way of doing it, please suggest a way.</li>
  </ol>