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