Class HMath


  • public final class HMath
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte abs​(byte value)  
      static double abs​(double value)  
      static float abs​(float value)  
      static int abs​(int value)  
      static long abs​(long value)  
      static short abs​(short value)  
      static double ceil​(double value)  
      static int divideCeiling​(int num, int denom)  
      static long divideCeiling​(long num, long denom)  
      static int divideUnsigned​(int num, int denom)  
      static long divideUnsigned​(long num, long denom)  
      static double floor​(double value)  
      static int interpolate​(int arg0, int arg1, double scale)  
      static int log2Ceiling​(byte value)  
      static int log2Ceiling​(int value)  
      static int log2Ceiling​(long value)  
      static int log2Ceiling​(short value)  
      static byte lsbMask​(byte value, boolean bit)  
      static int lsbMask​(int value, boolean bit)  
      static long lsbMask​(long value, boolean bit)  
      static short lsbMask​(short value, boolean bit)  
      static int lsbPosition​(byte value, boolean bit)  
      static int lsbPosition​(int value, boolean bit)  
      static int lsbPosition​(long value, boolean bit)  
      static int lsbPosition​(short value, boolean bit)  
      static byte max​(byte value0, byte value1)  
      static double max​(double value0, double value1)  
      static float max​(float value0, float value1)  
      static int max​(int value0, int value1)  
      static long max​(long value0, long value1)  
      static short max​(short value0, short value1)  
      static byte min​(byte value0, byte value1)  
      static double min​(double value0, double value1)  
      static float min​(float value0, float value1)  
      static int min​(int value0, int value1)  
      static long min​(long value0, long value1)  
      static short min​(short value0, short value1)  
      static byte minmaxDelta​(boolean max, byte base, byte value0, byte value1)  
      static <T> T minmaxDelta​(boolean max, byte base, byte value0, byte value1, T retVal0, T retVal1)  
      static char minmaxDelta​(boolean max, char base, char value0, char value1)  
      static <T> T minmaxDelta​(boolean max, char base, char value0, char value1, T retVal0, T retVal1)  
      static double minmaxDelta​(boolean max, double base, double value0, double value1)  
      static <T> T minmaxDelta​(boolean max, double base, double value0, double value1, T retVal0, T retVal1)  
      static float minmaxDelta​(boolean max, float base, float value0, float value1)  
      static <T> T minmaxDelta​(boolean max, float base, float value0, float value1, T retVal0, T retVal1)  
      static int minmaxDelta​(boolean max, int base, int value0, int value1)  
      static <T> T minmaxDelta​(boolean max, int base, int value0, int value1, T retVal0, T retVal1)  
      static long minmaxDelta​(boolean max, long base, long value0, long value1)  
      static <T> T minmaxDelta​(boolean max, long base, long value0, long value1, T retVal0, T retVal1)  
      static short minmaxDelta​(boolean max, short base, short value0, short value1)  
      static <T> T minmaxDelta​(boolean max, short base, short value0, short value1, T retVal0, T retVal1)  
      static byte mod​(byte n, byte m)  
      static int mod​(int n, int m)  
      static long mod​(long n, long m)  
      static short mod​(short n, short m)  
      static byte msbMask​(byte value, boolean bit)  
      static int msbMask​(int value, boolean bit)  
      static long msbMask​(long value, boolean bit)  
      static short msbMask​(short value, boolean bit)  
      static int msbPosition​(byte value, boolean bit)  
      static int msbPosition​(int value, boolean bit)  
      static int msbPosition​(long value, boolean bit)  
      static int msbPosition​(short value, boolean bit)  
      static double parseDouble​(String string)  
      static float parseFloat​(String string)  
      static int popCount​(byte _value)  
      static int popCount​(int value)  
      static int popCount​(long value)  
      static int popCount​(short _value)  
      static byte power​(byte value, byte exponent)  
      static double power​(double value, double exponent)  
      static float power​(float value, float exponent)  
      static int power​(int value, int exponent)  
      static long power​(long value, long exponent)  
      static short power​(short value, short exponent)  
      static double random()  
      static byte reverse​(byte value)  
      static int reverse​(int value)  
      static long reverse​(long value)  
      static short reverse​(short value)  
      static byte rotate​(byte value, int rotation)
      Rotate the bits of value left by the specified amount.
      static int rotate​(int value, int rotation)
      Rotate the bits of value left by the specified amount.
      static long rotate​(long value, int rotation)
      Rotate the bits of value left by the specified amount.
      static short rotate​(short value, int rotation)
      Rotate the bits of value left by the specified amount.
      static double round​(double value)  
      static Sign sign​(byte value)
      Return -1, 0 or 1 if the input is negative, zero or positive respectively.
      static byte sign​(byte value, byte sign, boolean delta)  
      static byte sign​(byte value, Sign sign, boolean delta)  
      static Sign sign​(double value)
      Return -1, 0 or 1 if the input is negative, zero or positive respectively.
      static double sign​(double value, double sign, boolean delta)  
      static double sign​(double value, Sign sign, boolean delta)  
      static Sign sign​(float value)
      Return -1, 0 or 1 if the input is negative, zero or positive respectively.
      static float sign​(float value, float sign, boolean delta)  
      static float sign​(float value, Sign sign, boolean delta)  
      static Sign sign​(int value)
      Return -1, 0 or 1 if the input is negative, zero or positive respectively.
      static int sign​(int value, int sign, boolean delta)  
      static int sign​(int value, Sign sign, boolean delta)  
      static Sign sign​(long value)
      Return -1, 0 or 1 if the input is negative, zero or positive respectively.
      static long sign​(long value, long sign, boolean delta)  
      static long sign​(long value, Sign sign, boolean delta)  
      static Sign sign​(short value)
      Return -1, 0 or 1 if the input is negative, zero or positive respectively.
      static short sign​(short value, short sign, boolean delta)  
      static short sign​(short value, Sign sign, boolean delta)  
      static double sqrt​(double value)  
    • Method Detail

      • abs

        public static byte abs​(byte value)
      • abs

        public static double abs​(double value)
      • abs

        public static float abs​(float value)
      • abs

        public static int abs​(int value)
      • abs

        public static long abs​(long value)
      • abs

        public static short abs​(short value)
      • ceil

        public static double ceil​(double value)
      • divideCeiling

        public static int divideCeiling​(int num,
                                        int denom)
      • divideCeiling

        public static long divideCeiling​(long num,
                                         long denom)
      • divideUnsigned

        public static int divideUnsigned​(int num,
                                         int denom)
      • divideUnsigned

        public static long divideUnsigned​(long num,
                                          long denom)
      • floor

        public static double floor​(double value)
      • interpolate

        public static int interpolate​(int arg0,
                                      int arg1,
                                      double scale)
      • log2Ceiling

        public static int log2Ceiling​(byte value)
      • log2Ceiling

        public static int log2Ceiling​(int value)
      • log2Ceiling

        public static int log2Ceiling​(long value)
      • log2Ceiling

        public static int log2Ceiling​(short value)
      • lsbMask

        public static byte lsbMask​(byte value,
                                   boolean bit)
      • lsbMask

        public static int lsbMask​(int value,
                                  boolean bit)
      • lsbMask

        public static long lsbMask​(long value,
                                   boolean bit)
      • lsbMask

        public static short lsbMask​(short value,
                                    boolean bit)
      • lsbPosition

        public static int lsbPosition​(byte value,
                                      boolean bit)
      • lsbPosition

        public static int lsbPosition​(int value,
                                      boolean bit)
      • lsbPosition

        public static int lsbPosition​(long value,
                                      boolean bit)
      • lsbPosition

        public static int lsbPosition​(short value,
                                      boolean bit)
      • max

        public static byte max​(byte value0,
                               byte value1)
      • max

        public static double max​(double value0,
                                 double value1)
      • max

        public static float max​(float value0,
                                float value1)
      • max

        public static int max​(int value0,
                              int value1)
      • max

        public static long max​(long value0,
                               long value1)
      • max

        public static short max​(short value0,
                                short value1)
      • min

        public static byte min​(byte value0,
                               byte value1)
      • min

        public static double min​(double value0,
                                 double value1)
      • min

        public static float min​(float value0,
                                float value1)
      • min

        public static int min​(int value0,
                              int value1)
      • min

        public static long min​(long value0,
                               long value1)
      • min

        public static short min​(short value0,
                                short value1)
      • minmaxDelta

        public static byte minmaxDelta​(boolean max,
                                       byte base,
                                       byte value0,
                                       byte value1)
      • minmaxDelta

        public static <T> T minmaxDelta​(boolean max,
                                        byte base,
                                        byte value0,
                                        byte value1,
                                        T retVal0,
                                        T retVal1)
      • minmaxDelta

        public static char minmaxDelta​(boolean max,
                                       char base,
                                       char value0,
                                       char value1)
      • minmaxDelta

        public static <T> T minmaxDelta​(boolean max,
                                        char base,
                                        char value0,
                                        char value1,
                                        T retVal0,
                                        T retVal1)
      • minmaxDelta

        public static double minmaxDelta​(boolean max,
                                         double base,
                                         double value0,
                                         double value1)
      • minmaxDelta

        public static <T> T minmaxDelta​(boolean max,
                                        double base,
                                        double value0,
                                        double value1,
                                        T retVal0,
                                        T retVal1)
      • minmaxDelta

        public static float minmaxDelta​(boolean max,
                                        float base,
                                        float value0,
                                        float value1)
      • minmaxDelta

        public static <T> T minmaxDelta​(boolean max,
                                        float base,
                                        float value0,
                                        float value1,
                                        T retVal0,
                                        T retVal1)
      • minmaxDelta

        public static int minmaxDelta​(boolean max,
                                      int base,
                                      int value0,
                                      int value1)
      • minmaxDelta

        public static <T> T minmaxDelta​(boolean max,
                                        int base,
                                        int value0,
                                        int value1,
                                        T retVal0,
                                        T retVal1)
      • minmaxDelta

        public static long minmaxDelta​(boolean max,
                                       long base,
                                       long value0,
                                       long value1)
      • minmaxDelta

        public static <T> T minmaxDelta​(boolean max,
                                        long base,
                                        long value0,
                                        long value1,
                                        T retVal0,
                                        T retVal1)
      • minmaxDelta

        public static short minmaxDelta​(boolean max,
                                        short base,
                                        short value0,
                                        short value1)
      • minmaxDelta

        public static <T> T minmaxDelta​(boolean max,
                                        short base,
                                        short value0,
                                        short value1,
                                        T retVal0,
                                        T retVal1)
      • mod

        public static byte mod​(byte n,
                               byte m)
      • mod

        public static int mod​(int n,
                              int m)
      • mod

        public static long mod​(long n,
                               long m)
      • mod

        public static short mod​(short n,
                                short m)
      • msbMask

        public static byte msbMask​(byte value,
                                   boolean bit)
      • msbMask

        public static int msbMask​(int value,
                                  boolean bit)
      • msbMask

        public static long msbMask​(long value,
                                   boolean bit)
      • msbMask

        public static short msbMask​(short value,
                                    boolean bit)
      • msbPosition

        public static int msbPosition​(byte value,
                                      boolean bit)
      • msbPosition

        public static int msbPosition​(int value,
                                      boolean bit)
      • msbPosition

        public static int msbPosition​(long value,
                                      boolean bit)
      • msbPosition

        public static int msbPosition​(short value,
                                      boolean bit)
      • parseDouble

        public static double parseDouble​(String string)
      • parseFloat

        public static float parseFloat​(String string)
      • popCount

        public static int popCount​(byte _value)
      • popCount

        public static int popCount​(int value)
      • popCount

        public static int popCount​(long value)
      • popCount

        public static int popCount​(short _value)
      • power

        public static byte power​(byte value,
                                 byte exponent)
      • power

        public static double power​(double value,
                                   double exponent)
      • power

        public static float power​(float value,
                                  float exponent)
      • power

        public static int power​(int value,
                                int exponent)
      • power

        public static long power​(long value,
                                 long exponent)
      • power

        public static short power​(short value,
                                  short exponent)
      • random

        public static double random()
      • reverse

        public static byte reverse​(byte value)
      • reverse

        public static int reverse​(int value)
      • reverse

        public static long reverse​(long value)
      • reverse

        public static short reverse​(short value)
      • rotate

        public static byte rotate​(byte value,
                                  int rotation)
        Rotate the bits of value left by the specified amount. Rotate right if the amount is negative.
        Parameters:
        value - The value to rotate
        rotation - The number of positions to rotate by.
        Returns:
        The rotated value
      • rotate

        public static int rotate​(int value,
                                 int rotation)
        Rotate the bits of value left by the specified amount. Rotate right if the amount is negative.
        Parameters:
        value - The value to rotate
        rotation - The number of positions to rotate by.
        Returns:
        The rotated value
      • rotate

        public static long rotate​(long value,
                                  int rotation)
        Rotate the bits of value left by the specified amount. Rotate right if the amount is negative.
        Parameters:
        value - The value to rotate
        rotation - The number of positions to rotate by.
        Returns:
        The rotated value
      • rotate

        public static short rotate​(short value,
                                   int rotation)
        Rotate the bits of value left by the specified amount. Rotate right if the amount is negative.
        Parameters:
        value - The value to rotate
        rotation - The number of positions to rotate by.
        Returns:
        The rotated value
      • round

        public static double round​(double value)
      • sign

        public static Sign sign​(byte value)
        Return -1, 0 or 1 if the input is negative, zero or positive respectively.
        Parameters:
        value - The number to compute the signum of.
        Returns:
        -1, 0 or 1 if the input is negative, zero or positive respectively.
      • sign

        public static byte sign​(byte value,
                                byte sign,
                                boolean delta)
      • sign

        public static byte sign​(byte value,
                                Sign sign,
                                boolean delta)
      • sign

        public static Sign sign​(double value)
        Return -1, 0 or 1 if the input is negative, zero or positive respectively.
        Parameters:
        value - The number to compute the signum of.
        Returns:
        -1, 0 or 1 if the input is negative, zero or positive respectively.
      • sign

        public static double sign​(double value,
                                  double sign,
                                  boolean delta)
      • sign

        public static double sign​(double value,
                                  Sign sign,
                                  boolean delta)
      • sign

        public static Sign sign​(float value)
        Return -1, 0 or 1 if the input is negative, zero or positive respectively.
        Parameters:
        value - The number to compute the signum of.
        Returns:
        -1, 0 or 1 if the input is negative, zero or positive respectively.
      • sign

        public static float sign​(float value,
                                 float sign,
                                 boolean delta)
      • sign

        public static float sign​(float value,
                                 Sign sign,
                                 boolean delta)
      • sign

        public static Sign sign​(int value)
        Return -1, 0 or 1 if the input is negative, zero or positive respectively.
        Parameters:
        value - The number to compute the signum of.
        Returns:
        -1, 0 or 1 if the input is negative, zero or positive respectively.
      • sign

        public static int sign​(int value,
                               int sign,
                               boolean delta)
      • sign

        public static int sign​(int value,
                               Sign sign,
                               boolean delta)
      • sign

        public static Sign sign​(long value)
        Return -1, 0 or 1 if the input is negative, zero or positive respectively.
        Parameters:
        value - The number to compute the signum of.
        Returns:
        -1, 0 or 1 if the input is negative, zero or positive respectively.
      • sign

        public static long sign​(long value,
                                long sign,
                                boolean delta)
      • sign

        public static long sign​(long value,
                                Sign sign,
                                boolean delta)
      • sign

        public static Sign sign​(short value)
        Return -1, 0 or 1 if the input is negative, zero or positive respectively.
        Parameters:
        value - The number to compute the signum of.
        Returns:
        -1, 0 or 1 if the input is negative, zero or positive respectively.
      • sign

        public static short sign​(short value,
                                 short sign,
                                 boolean delta)
      • sign

        public static short sign​(short value,
                                 Sign sign,
                                 boolean delta)
      • sqrt

        public static double sqrt​(double value)