title: Java Arry Index Out of Bound Exception
body: <p>I have been working on this basic java program when I need to store 5 user entered values into an array, send it to a method, and find and display the lowest value.</p>
  
  <p>The program is simple enough, and it runs, but when I enter the last number, I get the error:</p>
  
  <p>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
          at minNumber.main(minNumber:14)</p>
  
  <p>Help?</p>
  
  <pre><code>import java.util.*;
  
  class minNumber {
  
  
      public static void main(String args[]){
  
      Scanner input = new Scanner(System.in);
  
      int numberArray[] = new int[4];
      int findLowest;
  
      for (int i = 0; i &lt;= numberArray.length; i++){
          System.out.println("Enter a value for slot "+(i+1)+ ":");
          numberArray[i] = input.nextInt();   
      }
      findLowest = getMin(numberArray);
      displayOutput(findLowest);
  }
  
  public static int getMin(int num[]){
  
  int lowestNum = 0;
  for (int j = 0; j &lt;= num.length; j++){
      if (num[j] &lt; num[j+1]){
  
          lowestNum = num[j];
      }
  }
  return lowestNum;
  }
  
  public static void displayOutput(int lowest){
  
  System.out.println("The lowest number is: "+lowest);
  }
  }
  </code></pre>