mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 18:32:56 +08:00
optimization
This commit is contained in:
@ -18,7 +18,7 @@ public class AbsoluteValue {
|
||||
* @return the absolute value of a number
|
||||
*/
|
||||
public static int absVal(int value) {
|
||||
return value > 0 ? value : -value;
|
||||
return value < 0 ? -value : value;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user