From 80f658e748e82d7fba379e59a017f4aa8cb71d08 Mon Sep 17 00:00:00 2001 From: meiamsome Date: Sat, 18 Aug 2012 21:56:46 +0200 Subject: [PATCH] Added roundDown Added another round function as required. --- com/Acrobot/Breeze/Utils/NumberUtil.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/com/Acrobot/Breeze/Utils/NumberUtil.java b/com/Acrobot/Breeze/Utils/NumberUtil.java index 4a3f6f1..94b3f26 100644 --- a/com/Acrobot/Breeze/Utils/NumberUtil.java +++ b/com/Acrobot/Breeze/Utils/NumberUtil.java @@ -65,7 +65,7 @@ public class NumberUtil { } /** - * Rounds the number up to two digit points (Can be inaccurate due to using decimal-points) + * Rounds the number up to two decimal points (Can be inaccurate due to using decimal-points) * * @param number Number to round * @return Rounded number @@ -73,6 +73,15 @@ public class NumberUtil { public static double roundUp(double number) { return Math.ceil(number * 100) / 100; } + /** + * Rounds the number down to two decimal points + * + * @param number Number to round + * @return Rounded number + */ + public static double roundDown(double number) { + return Math.floor(number * 100) / 100; + } /** * Converts the number (in seconds) to timer-like format, like 2:00 (minutes:seconds)