aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/utils/Utils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker/utils/Utils.java')
-rw-r--r--src/main/java/me/Danker/utils/Utils.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index 835e613..7153014 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -113,4 +113,11 @@ public class Utils {
return String.join(" ", words);
}
+ public static double getPercentage(int num1, int num2) {
+ if (num2 == 0) return 0D;
+ double result = ((double) num1 * 100D) / (double) num2;
+ result = Math.round(result * 100D) / 100D;
+ return result;
+ }
+
}