Skip to content

Commit 95c60c5

Browse files
Merge pull request #1 from TheAlgorithms/master
Refactor getAbsValue method to use Math.abs (TheAlgorithms#7266)
2 parents 0c79d33 + 504b528 commit 95c60c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)