From 5c4e3c3fb9392fb2784ff6ecbb62f008436b32dc Mon Sep 17 00:00:00 2001
From: Ryanator <ryanmorris@rogers.com>
Date: Fri, 1 Nov 2024 14:51:47 -0400
Subject: [PATCH] Added a check to throw a IllegalArguemntException before
 division by 0

---
 src/com/jwetherell/algorithms/mathematics/Division.java | 3 +++
 1 file changed, 3 insertions(+)

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