Class BitSetUtil


  • public class BitSetUtil
    extends Object
    A utility for certain operations on BitSet. This is used in places for some crytographic operations.

    Created by Jeff Gaynor
    on 3/20/20 at 10:00 AM

    • Constructor Detail

      • BitSetUtil

        public BitSetUtil()
    • Method Detail

      • orCompress

        public static boolean orCompress​(BitSet bitSet)
        Apply or between each element of this set. So if the elements are
         {a0,a1,a2,...,an}
         
        then the result is
             a0 || a1 || a2 || ... || an
         
        Returns:
      • andCompress

        public static boolean andCompress​(BitSet bitSet)
        Ditto orCompress(BitSet) except the returned value is
             a0 && a1 && a2 && ... && an
         
        Returns:
      • compress

        protected static boolean compress​(BitSet bitSet,
                                          boolean doAnd)
        Internal method for other compress operations.
        Parameters:
        bitSet -
        doAnd -
        Returns:
      • toInt

        public static int toInt​(BitSet bitSet)
        Take a bit vector (representing the place values) and return the integer in base 2. So if the bitset is {1,2,3,4,5} then this returns 0 + 2 + 4 + 8 + 16 + 32
        Parameters:
        bitSet -
        Returns: