My problem is that program is not reading codes as i intended \"he\" would.
I have
if (hero.getPos() == (6 | 11 | 16)) { move = new Object[] {\"Up\",
Use:
if (hero.getPos() == 6 || hero.getPos() == 11 || hero.getPos() == 16)) {
This will do what you want.
What you did is comparing hero.getPos() with the result of (6|11|16) which will do bitwise or between those numbers.
hero.getPos()
(6|11|16)