Inconsistent IndexOutOfBounds Exceptions

Hey,

I’ve been working on a simple space invaders clone since noon and I keep running into inconsistent errors that I have trouble replicating every game that I test. The most common error is with the following line in the loop that follows it.

if(projectiles.get(i).getColissionBox().intersects(entities.get(j).getColissionBox())
// Check if any bullet has collided with any alien entity. If a bullet has then remove it and remove the entity.
		for(int i=0;i<projectiles.size();i++) {
			for(int j=0;j<entities.size();j++) {
				if(projectiles.get(i).getColissionBox().intersects(entities.get(j).getColissionBox())) {
					playerScore += entities.get(j).getSpeed() * 10;
					entities.remove(j); // Remove dead entities.
					projectiles.remove(i); // Remove the projectile that was used to kill the entity.
				}
			}
		}

Below here is the entire class.

package level;

import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;

import core.KeyboardInputHandler;
import entity.Alien;
import entity.Entity;
import entity.Player;
import entity.projectile.Bullet;
import entity.projectile.Projectile;

public class Level {
	private int playerScore = 0;
	private int levelsCompleted = 0;
	private int playerShootTimer = 100;
	//private BufferedImage background;
	private Player playerEntity;
	private List<Entity> entities = new ArrayList<Entity>();
	private List<Projectile> projectiles = new ArrayList<Projectile>();
	
	public Level() {
		playerEntity = new Player("Player", 512, 448);
	}
	
	public void update(final KeyboardInputHandler KEY_INPUT) {
		if(entities.size() == 0) {
			// Remove all projectiles from the level before spawning new entities.
			int projectilesSize = projectiles.size();
			if(projectilesSize > 0) {
				for(int i=0;i<projectiles.size();i++) {
					projectiles.remove(i);
				}
			}
			
			// Spawn new entities.
			for(int i=0;i<10;i++) {
				for(int j=0;j<5;j++) {
					entities.add((levelsCompleted > 0 ?  new Alien("Creature - "+i, i * 64 , j * 64, levelsCompleted) : new Alien("Creature - "+i, i * 64 , j * 64)));
				}
			}
			
			// Increase the level counter.
			if(playerScore > 0) {
				levelsCompleted++;
			}
		}
		
		// Check if any bullet has collided with any alien entity. If a bullet has then remove it and remove the entity.
		for(int i=0;i<projectiles.size();i++) {
			for(int j=0;j<entities.size();j++) {
				if(projectiles.get(i).getColissionBox().intersects(entities.get(j).getColissionBox())) {
					playerScore += entities.get(j).getSpeed() * 10;
					entities.remove(j); // Remove dead entities.
					projectiles.remove(i); // Remove the projectile that was used to kill the entity.
				}
			}
		}
				
		// Update the player.
		playerEntity.update(KEY_INPUT);
		
		// Update all entities.
		for(int i=0;i<entities.size();i++) {
			entities.get(i).update();
		}
		
		// Remove projectiles if they're off-screen, if it's not off-screen then update it.
		for(int i=0;i<projectiles.size();i++) {
			if(projectiles.get(i).getIsVisible()) {
				projectiles.get(i).update();
			} else {
				projectiles.remove(i);
			}
		}
		
		// If the user presses the space bar and if the timer is at 10 or above then create a new projectile.
		if(KEY_INPUT.isKeyPressed(KeyEvent.VK_SPACE) && playerShootTimer >= 40) {
			// This requires that the player entity be at index 0 of the entities list.
			projectiles.add(new Bullet(playerEntity.getXPosition() + (playerEntity.getSprite().getWidth () / 2), playerEntity.getYPosition(), true, (2 + levelsCompleted)));
			playerShootTimer = 0;
		} else {
			playerShootTimer++;
		}
	}
	
	public void render(final Graphics g) {
		// Draw the background.
		//g.drawImage(background, 0, 0, background.getHeight(), background.getWidth(), null);
				
		
		// Render player.
		playerEntity.render(g);
		
		// Render entities.
		for(int i=0;i<entities.size();i++) {
			entities.get(i).render(g);
		}
		
		// Render projectiles.
		for(int i=0;i<projectiles.size();i++) {
			projectiles.get(i).render(g);
		}
	}
	
	public boolean isGameOver() {
		boolean tempVar = false;
		
		// Check if the game is over yet.
		for(int i=0;i<entities.size();i++) {
			if(entities.get(i).getYPosition() >= 448) {
				tempVar =  true;
				break;
			}
		}
		
		return tempVar;
	}
	
	// Get methods:
	public int getPlayerScore() {
		return playerScore;
	}
}

Thanks in advance if anyone can see some error that I’ve made with the loop or something.