будет ли работать вариант? int q; if (x>0&&y>0) q = 1; if (x<0&&y>0) q = 2; if (x<0&&y<0) q = 3; if (x>0&&y<0) q = 4; System.out.println(q);