java.lang.Object
com.github.imdabigboss.easydatapack.api.utils.ExtraMath

public class ExtraMath extends Object
Some math utilities.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    clamp​(int value, int min, int max)
    Clamp a number between two other numbers.
    static int
    max​(int... a)
    Finds the biggest number in the provided arguments.
    static int
    min​(int... a)
    Finds the smallest number in the provided arguments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExtraMath

      public ExtraMath()
  • Method Details

    • max

      public static int max(int... a)
      Finds the biggest number in the provided arguments.
      Parameters:
      a - the numbers to compare
      Returns:
      the biggest number
    • min

      public static int min(int... a)
      Finds the smallest number in the provided arguments.
      Parameters:
      a - the numbers to compare
      Returns:
      the smallest number
    • clamp

      public static int clamp(int value, int min, int max)
      Clamp a number between two other numbers. For example if you have a number that is 10 and you want to clamp it between 0 and 5, it will return 5. If you have a number that is 3 and you want to clamp it between 0 and 5, it will return 3. If you have a number that is -1 and you want to clamp it between 0 and 5, it will return 0.
      Parameters:
      value - the number to clamp
      min - the minimum value
      max - the maximum value
      Returns:
      the clamped number