title: java.lang.ArrayIndexOutOfBoundsException: 48
body: <p>I have an exercise on Dijkstra's Algorithm and when I run my programm I get the following error:
       Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 48<br>
      What is wrong? I can't sent the entire code because it is 200 lines. But the problem appears in those lines in cmd<br>
      dist[i] = Integer.MAX_VALUE; and
      dist[i] = 0;</p>
  
  <p>Thanks in advnace for your help.</p>
  
  <pre><code>public static void DijkstraOnNode (int start) {
  
    int[] dist = new int [myNodes.size()]; //where myNodes is an ArrayList of Hashset&lt;Link&gt;
                                           //and Link is a class that contains node kai weight       
    int[] pred = new int [myNodes.size()];  
    int[] pq = new int [myNodes.size()];
  
   for (int i = 0; i &lt;= myNodes.size(); i++) {
  
      if (i!= start)
          dist[i] = Integer.MAX_VALUE;
      else
          dist[i] = 0;
  
     pq[i] = dist[i];
  }
  </code></pre>
  
  <p>(the code continues)</p>