mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
Refactor getAbsValue method to use Math.abs (#7266)
This commit is contained in:
committed by
GitHub
parent
0c79d33eb5
commit
504b5283eb
@@ -11,6 +11,6 @@ public final class AbsoluteValue {
|
||||
* @return The absolute value of the {@code number}
|
||||
*/
|
||||
public static int getAbsValue(int number) {
|
||||
return number < 0 ? -number : number;
|
||||
return Math.abs(number);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user