Class NumTools
java.lang.Object
com.expedient.adventofcodejade.util.NumTools
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longfastCat(long one, long two) Concatenates two longs without using string operationsstatic intfastCatInt(int one, int two) Concatenates two ints without using string operationsstatic long[]solveSystemOfEquations(long[] coefficientsA, long[] coefficientsB, long[] constantsC) Use Cramer's Rule to solve a 2x2 system of equations with determinants, providing a set of values for x and y that satisfies the given equations
-
Constructor Details
-
NumTools
public NumTools()
-
-
Method Details
-
fastCatInt
public static int fastCatInt(int one, int two) Concatenates two ints without using string operations- Parameters:
one- the first inttwo- the second int- Returns:
- a new int that is the result of concatenating the two given as if they were Strings
-
fastCat
public static long fastCat(long one, long two) Concatenates two longs without using string operations- Parameters:
one- the first longtwo- the second long- Returns:
- a new long that is the result of concatenating the two given as if they were Strings
-
solveSystemOfEquations
public static long[] solveSystemOfEquations(long[] coefficientsA, long[] coefficientsB, long[] constantsC) Use Cramer's Rule to solve a 2x2 system of equations with determinants, providing a set of values for x and y that satisfies the given equations- Parameters:
coefficientsA- the coefficients a1 and a2coefficientsB- the coefficients b1 and b2constantsC- the constants on the other side of the equals sign- Returns:
- an array containing a value for x and y that satisfies both equations
-