title: Checking out of bounds in Java
body: <p>I'm trying to check if an array location is out of bounds, what's the simplest way?</p>
  
  <pre><code>int[] arr;
  populate(arr);
  if(arr[-1] == null)
  //out of bounds!
  </code></pre>
  
  <p>Would something like this work?</p>
  
  <p>I'm pretty sure this can be done with a trycatch or a scanner but for just a simple small program, is there another way?</p>