mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-10 21:43:15 +08:00
@ -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