Class MathUtil

java.lang.Object
com.viaversion.viaversion.util.MathUtil

public final class MathUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    ceilLog2(int i)
    Returns the ceiled log to the base of 2 for the given number.
    static int
    clamp(int i, int min, int max)
    Returns the clamped number within the given range.

    Methods inherited from class java.lang.Object

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

    • MathUtil

      public MathUtil()
  • Method Details

    • ceilLog2

      public static int ceilLog2(int i)
      Returns the ceiled log to the base of 2 for the given number.
      Parameters:
      i - positive number to ceillog
      Returns:
      ceiled log2 of the given number
    • clamp

      public static int clamp(int i, int min, int max)
      Returns the clamped number within the given range.
      Parameters:
      i - number to clamp
      min - minimum value
      max - maximum value
      Returns:
      clamped number