I have a 2d array that looks like this:
1 1 1 1
1 1 1 1
1 1 1 1
0 1 1 1
I want to store in an ArrayList called neighbors the right value of 0. However if I call
neigbors.add(location[4][1])
I will get the value "1", insted of (4,1). Is there any way I can do it? Let me mention I use these variables:
List<Integer> neighbors = new ArrayList<Integer>();
int[][] locations = new int[5][5];