Class MMath


  • public class MMath
    extends Object
    • Constructor Detail

      • MMath

        public MMath()
    • Method Detail

      • toBasis36

        public static String toBasis36​(long value,
                                       int digits)
        Pack the number in a base 36 numerical system. This means the characters 0-9 A-Z are used. This is the maximum packed system if you want to use case insensitive strings.
        Parameters:
        value - The value to convert
        digits - number of minimum digits (expect the minus character if the value is negative)
        Returns:
        encoded string
      • toBasis36WithIdent

        public static String toBasis36WithIdent​(long value,
                                                long ident,
                                                int digits)
        Pack the number in a base 36 numerical system. This means the characters 0-9 A-Z are used. This is the maximum packed system if you want to use case insensitive strings. This function creates ids specially for logger traces.
        Parameters:
        value - The value to convert
        ident - additional ident at the right side, has 4 digits
        digits - number of minimum digits (expect the minus character if the value is negative)
        Returns:
        encoded string
      • truncateDecimals

        public static double truncateDecimals​(double d,
                                              int len)
      • pow

        public static long pow​(long a,
                               int b)
      • unsignetByteToInt

        public static int unsignetByteToInt​(byte b)
      • rotr

        public static int rotr​(int data,
                               int distance)
      • rotl

        public static int rotl​(int data,
                               int distance)
      • rotr

        public static byte rotr​(byte data,
                                int distance)
      • rotl

        public static byte rotl​(byte data,
                                int distance)
      • addRotate

        public static byte addRotate​(byte b,
                                     byte add)
      • subRotate

        public static byte subRotate​(byte b,
                                     byte add)