Class MathUtils


  • public class MathUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int ceil​(float value)
      Returns the smallest integer greater than or equal to the specified float.
      static int floor​(float value)
      Returns the largest integer less than or equal to the specified float.
      static float limit​(float number, float between, float and)
      Limits the given number between the other values
      static int limit​(int number, int between, int and)
      Limits the given number between the other values
      static float max​(float number, float max)  
      static int max​(int number, int max)  
      static float min​(float number, float min)  
      static int min​(int number, int min)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • limit

        public static int limit​(int number,
                                int between,
                                int and)
        Limits the given number between the other values
        Parameters:
        number - The number to limit.
        between - The smallest value the number can take.
        and - The biggest value the number can take.
        Returns:
        The limited number.
      • limit

        public static float limit​(float number,
                                  float between,
                                  float and)
        Limits the given number between the other values
        Parameters:
        number - The number to limit.
        between - The smallest value the number can take.
        and - The biggest value the number can take.
        Returns:
        The limited number.
      • max

        public static float max​(float number,
                                float max)
      • min

        public static float min​(float number,
                                float min)
      • max

        public static int max​(int number,
                              int max)
      • min

        public static int min​(int number,
                              int min)
      • floor

        public static int floor​(float value)
        Returns the largest integer less than or equal to the specified float. This method will only properly floor floats from -(2^14) to (Float.MAX_VALUE - 2^14).
      • ceil

        public static int ceil​(float value)
        Returns the smallest integer greater than or equal to the specified float. This method will only properly ceil floats from -(2^14) to (Float.MAX_VALUE - 2^14).