diff --git a/src/com/jwetherell/algorithms/mathematics/Division.java b/src/com/jwetherell/algorithms/mathematics/Division.java index c133f741..51d6ce46 100644 --- a/src/com/jwetherell/algorithms/mathematics/Division.java +++ b/src/com/jwetherell/algorithms/mathematics/Division.java @@ -3,6 +3,9 @@ public class Division { public static final long division(int a, int b) { + if( b == 0 ){ + throw new IllegalArgumentException("Cannot divide by zero!"); + } long result = ((long) a) / ((long) b); return result; }