From e76f9156bea6c2f17d7e2a06744f475de7252da9 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Mon, 24 Oct 2016 02:39:52 +1000 Subject: + Finally finished the Chemical Compound Tooltips. Still needs formatting improvements, but the figures and compound should be correct. ☼ Broke Mixer recipes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Java/gtPlusPlus/core/util/math/MathUtils.java | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/Java/gtPlusPlus/core/util') diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index b4aec5a8bf..8fab1341d3 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -222,5 +222,37 @@ public class MathUtils { Utils.LOG_WARNING("It will decode into "+Integer.decode(temp)+"."); return Integer.decode(temp); } + + public static long[] simplifyNumbersToSmallestForm(long[] inputArray){ + long GCD = gcd(inputArray); + long[] outputArray = new long[inputArray.length]; + for (int i=0;i 0) + return outputArray; + return null; + } + + private static long gcd(long a, long b){ + while (b > 0) + { + long temp = b; + b = a % b; // % is remainder + a = temp; + } + return a; + } + + private static long gcd(long[] input){ + long result = input[0]; + for(int i = 1; i < input.length; i++) result = gcd(result, input[i]); + return result; + } + + } -- cgit