The ternary operator (a>b)?a:b avoids method call overhead and is executed inline by the JVM. Math.max() requires a method invocation, which involves stack frame creation and overhead even if the JIT compiler eventually inlines it. For simple comparisons, the ternary is measurably faster.