Class IntegerTypes


  • public class IntegerTypes
    extends java.lang.Object
    • Field Detail

      • signedTypes

        private static java.util.List<? extends IntegerType<?>> signedTypes
      • unsignedTypes

        private static java.util.List<? extends IntegerType<?>> unsignedTypes
    • Constructor Detail

      • IntegerTypes

        private IntegerTypes()
    • Method Detail

      • smallestType

        public static IntegerType<?> smallestType​(boolean signed,
                                                  long max)
        Get an IntegerType that can hold the given max value. The smallest byte-size type matching the constraints will be selected.
        Parameters:
        signed - - true if a signed IntegerType is required
        max - - the expected maximum value
        Returns:
        an IntegerType matching the given constraints
      • smallestType

        public static IntegerType<?> smallestType​(long min,
                                                  long max)
        Get an IntegerType that can hold the given min and max values. The smallest byte-size type matching the constraints will be selected, with a preference for unsigned types.
        Parameters:
        min - - the expected minimum value
        max - - the expected maximum value
        Returns:
        an IntegerType matching the given constraints