I call function move with 2 dimensional array full of zeros at point [6, 5] which has value 0. The function increases the value to 1.
Then the same function call itself again move(x - 1, y, map, i), which means it is at point [5, 5] with value 0, which it increases to 1 and ends itself.
But why was the map variable updated also in the function, which was called first?
private static byte[10][10] myMap = {*all zeros*};
public static void main(String[] args) {
    move(6, 5, myMap, 0);
}
private static void move(int x, int y, byte[][] map, int i) {
    if (map[x][y] == 0) {
        map[x][y]++;
        i++;
    }
    if (i > 1) return;
    System.out.print(x + " " + y);
    // 6 5
    System.out.print(map[5][5] + " " + i);
    // 0 1
    move(x - 1, y, map, i);
    System.out.print(map[5][5] + " " + i);
    // 1 1 ... WTH? Shouldn't this return 0 1 like above?
}
And when it updates the map, why it doesn't update the i variable?
I'm struggling hours to find why, but still don't know:/ Thanks for help
 
    