optimization

This commit is contained in:
shellhub
2019-09-28 10:19:39 +08:00
parent 42ca38b005
commit 971f22cad2

View File

@ -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;
} }
} }