Class NumTools

java.lang.Object
com.expedient.adventofcodejade.util.NumTools

public class NumTools extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    fastCat(long one, long two)
    Concatenates two longs without using string operations
    static int
    fastCatInt(int one, int two)
    Concatenates two ints without using string operations
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 int
      two - 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 long
      two - 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 a2
      coefficientsB - the coefficients b1 and b2
      constantsC - the constants on the other side of the equals sign
      Returns:
      an array containing a value for x and y that satisfies both equations