Skip to content

Commit 504b528

Browse files
Refactor getAbsValue method to use Math.abs (#7266)
1 parent 0c79d33 commit 504b528

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/maths/AbsoluteValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ private AbsoluteValue() {
1111
* @return The absolute value of the {@code number}
1212
*/
1313
public static int getAbsValue(int number) {
14-
return number < 0 ? -number : number;
14+
return Math.abs(number);
1515
}
1616
}

0 commit comments

Comments
 (0)