Class MathUtils


  • public class MathUtils
    extends java.lang.Object
    Author:
    Loc Ha
    • Constructor Summary

      Constructors 
      Constructor Description
      MathUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int ceil​(int n, int base)  
      static boolean isPow2​(long n)  
      static <T> T max​(T a, T b, java.util.Comparator<T> comparator)  
      static <T> T min​(T a, T b, java.util.Comparator<T> comparator)  
      static byte[] toByteArray​(int value)  
      static byte[] toByteArray​(int begin, int end)  
      static byte[] toByteArray​(long value)  
      static int toInt​(byte[] bytes)  
      static long toLong​(byte[] bytes)  
      • Methods inherited from class java.lang.Object

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

      • MathUtils

        public MathUtils()
    • Method Detail

      • isPow2

        public static boolean isPow2​(long n)
      • ceil

        public static int ceil​(int n,
                               int base)
      • toByteArray

        public static byte[] toByteArray​(int value)
      • toInt

        public static int toInt​(byte[] bytes)
      • toByteArray

        public static byte[] toByteArray​(long value)
      • toLong

        public static long toLong​(byte[] bytes)
      • toByteArray

        public static byte[] toByteArray​(int begin,
                                         int end)
      • min

        public static <T> T min​(T a,
                                T b,
                                java.util.Comparator<T> comparator)
      • max

        public static <T> T max​(T a,
                                T b,
                                java.util.Comparator<T> comparator)