Tagged articles
1 articles
Page 1 of 1
FunTester
FunTester
Nov 25, 2020 · Fundamentals

Why Math.abs(Integer.MIN_VALUE) Returns a Negative Value in Java

The article explains that Math.abs() can return a negative result when applied to Integer.MIN_VALUE because the absolute value exceeds the int range, detailing the two's‑complement representation, overflow behavior, and how the JLS defines the operation.

buginteger-min-valuemath.abs
0 likes · 4 min read
Why Math.abs(Integer.MIN_VALUE) Returns a Negative Value in Java