About: java.lang.ArrayndexOutOfBoundsException: 6
<p>I'm having some difficulties finding a solution for this error. I can't seem to figure out why. By the way, I'm new to programming.</p>

<pre><code>public class Player{
private Map map;
private Image player2;
private double x;
private double y;
private double deltaX = 250;
private double deltaY = 250;    
private int width;
private int height;

public Player(){    
    player2 = new ImageIcon("C://images//ball.PNG").getImage();
    x = 0;
    y = 0;
    deltaX = 100;
    deltaY = 100;           
}

public void movePlayer(long delta){
    map = new Map();    

     if(x &gt; width){
       x = width;
       //vertical = true;
       deltaX =  -deltaX;           
    }else if(x &lt; 0){
       x = 0;
       deltaX = -deltaX;
    }

    else{
       x += (delta * deltaX) / 1000;
    }   

    //This one can't execute properly 
    if(map.getMap(x, y)) {
        System.out.println("Collided");
    }else{

    }   
}   

public void draw(Graphics2D g){

    g.drawImage(player2, (int)x,  (int)y, null);
}
</code></pre>

<p>}</p>

<p>This is the Map class:</p>

<pre><code>public class Map{
private Image tile1;
private int map[][] = {{1, 1, 1, 1, 1}, 
             {1, 1, 1, 1, 1},
             {1, 1, 1, 1, 1},
             {1, 1, 1, 1, 1},
             {1, 1, 1, 1, 0},               
        };

public Map(){
    tile1 = new ImageIcon("C://images//tile1.PNG").getImage();      

}

public boolean getMap(double x, double y){      
    return map[(int)x][(int)y] == 0;
}

public void draw(Graphics2D g){
    for(int x = 0; x &lt; map.length; x++){
       for(int y = 0; y &lt; map.length; y++){
           if(map[x][y] == 0)
             g.drawImage(tile1, x*33, y*33, null);          
       }
    }
}
</code></pre>

<p>}</p>

<p>I hope someone could point out where I'm doing wrong... Thanks</p>
