negative math.abs code example Example: finding absolute value in java Click to copyimport java.lang.Math; int sum,x=-5; sum = Math.abs(x);