int x = 10-a; int z = b-10; abs(x); abs(z); if (x<=z) System.out.println(a); else System.out.println(b);