Package xyz.cofe.num

Enum BitCount

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      BIG
      Большие числа (BigInteger/BigDecimal)
      BYTE
      1 Байт = 8 Бит
      INT
      4 Байта
      LONG
      8 Байт
      SHORT
      2 Байта
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int bits
      Кол-во бит на число
    • Enum Constant Detail

      • BYTE

        public static final BitCount BYTE
        1 Байт = 8 Бит
      • SHORT

        public static final BitCount SHORT
        2 Байта
      • INT

        public static final BitCount INT
        4 Байта
      • LONG

        public static final BitCount LONG
        8 Байт
      • BIG

        public static final BitCount BIG
        Большие числа (BigInteger/BigDecimal)
    • Field Detail

      • bits

        public final int bits
        Кол-во бит на число
    • Method Detail

      • values

        public static BitCount[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BitCount c : BitCount.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BitCount valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • of

        public static BitCount of​(Number n)
        Возвращает приблизительное кол-во используемых бит для указанного числа
        Parameters:
        n - число
        Returns:
        кол-во бит или null если не возможно определить
      • max

        public static BitCount max​(Number n1,
                                   Number n2)
        Возвращает максимальное преблизительное кол-во бит для указанных чисел, если нет возможности определить of(Number):
        • есть хоть одно значение, то испольуеться оно
        • если отсуствуют оба, то используется INT
        Parameters:
        n1 - число
        n2 - число
        Returns:
        кол-во бит