MCPcopy Index your code
hub / github.com/careercup/ctci / abs

Method abs

java/Chapter 7/Question7_4/Question.java:21–26  ·  view source on GitHub ↗
(int a)

Source from the content-addressed store, hash-verified

19
20 /* Return absolute value */
21 public static int abs(int a) {
22 if (a < 0) {
23 return negate(a);
24 }
25 else return a;
26 }
27
28 /* Multiply a by b by adding a to itself b times */
29 public static int multiply(int a, int b) {

Callers 10

multiplyMethod · 0.95
divideMethod · 0.95
checkHeightMethod · 0.80
isBalancedMethod · 0.80
isApproxEqualMethod · 0.80
extendMethod · 0.80
intersectMethod · 0.80
LineMethod · 0.80
isEquivalentMethod · 0.80
checkValidMethod · 0.80

Calls 1

negateMethod · 0.95

Tested by

no test coverage detected