Using ArrayList<int>

it is supposed to find all the squares of the same color (or value) that are sharing an edge with it

edit: and put them into an ArrayList (in form of a number (x + y*w))