title: How to find if an array index Exists?
body: <p>Basically I need to check if a <code>String</code> contains 2 indexes.
  Based on my googling I found that I could Either use <code>part[0].length() &gt; 0</code> || <code>part[0] != null</code> But none happen to help me here.</p>
  
  <p>My code:</p>
  
  <pre><code>String[] parts = datareceived.split("&amp;");
  
  if(!(parts[0].length()&gt;0) &amp;&amp; parts[0] == null){
      out.print("String is null");
      return;
  }
  
  if(!(parts[1].length()&gt;0) &amp;&amp; parts[1] == null){
      out.print("String is null");
      return;
  } 
  </code></pre>
  
  <p>But here in <code>parts[1]</code> i'm getting an exception which says:</p>
  
  <blockquote>
    <p>java.lang.ArrayIndexOutOfBoundsException: 1
        at pack.reg.pack.serv.doPost(serv.java:10)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)</p>
  </blockquote>
  
  <p>Thanks in advance!</p>