The shortest java code [closed]

Almost correct:

System.out.println((int)Math.signum(input.nextInt() - input.nextInt());

Almost” due to possible integer overlow. Also your longer code might actually be faster (signum() operaton on floating-point numbers), not to mention more readable.

Leave a Comment