title: Arraylist Pang Game , Arrow class
body: <p>When i shoot the arrow and its hits the bubble a few times , its generates on a random moment a lot of arrows and crashed i cant find why this happens</p>
  
  <p>for (int i = 0; i &lt; bubblesArray.size(); i++) {</p>
  
  <pre><code>bubblesArray.get(i).move();
  bubblesArray.get(i).checkBorders();
  bubblesArray.get(i).display();
  
  if (bubblesArray.get(i).checkHit(p)) {
  }
  
  for (int j = 0; j &lt; arrowArray.size(); j++) {
  
    arrowArray.get(j).shoot();
    arrowArray.get(j).display();
  
    // verwijderd array wanneer die buiten scherm komt
  
      if (arrowArray.get(j).getPosYArrow()+arrowArray.get(j).getHeightArrow() &lt; 0) {
        arrowArray.remove(j);
  
    }
  
    // verwijder array wanneer die tegen bubble zit
  
    if (bubblesArray.get(i).checkHitArrow(arrowArray.get(j))) {
      timesHit+=1;
      numberOfBubble*=2;
  
     if(arrowArray.size()&gt;=0){
      arrowArray.remove(j);
     }
      // aanmaken nieuwe bubble
      bubbleWidth = bubble.width/2;
      bubbleHeight = bubble.height/2;
      bubble.resize(bubbleWidth, bubbleHeight);
  
      for ( int k = 0; k &lt; numberOfBubble; k++) {
  
        bubblesArray.add(new Bubbles(bubblesArray.get(i).getPosXBubbles(), bubblesArray.get(i).getPosYBubbles(), bubble));
      }
      bubblesArray.remove(i);
    }
  }
  </code></pre>
  
  <p>}
  }</p>
  
  <p>void keyPressed() {</p>
  
  <p>if (key == ' ') {</p>
  
  <pre><code>arrowArray.add(new Arrow(arrow, p.getPosXPlayer()+p.getWidthPlayer()/2, p.getPosYPlayer()));
  printArray(arrowArray);
  </code></pre>
  
  <p>}
  }</p>
  
  <p>erros and draw error; <a href="https://imgur.com/a/6Yi1GvH" rel="nofollow noreferrer">https://imgur.com/a/6Yi1GvH</a></p>