// testing extracted bits for patterns of 0s and 1s.

// testing bits for all 0s, no need to shift first.
if ( ( x & mask ) == 0 )

   // testing bits for any 1s, no need to shift first.
   if ( ( x & mask ) != 0 )

      // testing bits for all 1s, no need to shift first.
      if ( ( x & mask ) == mask )

         // testing bits for a particular pattern.
         if ( ( x & mask ) == pattern )

            // testing if a single bit is 0
            if ( ( (  x >>> n ) & 1 ) == 0 )

               // testing if a single bit is 1
               if ( ( (  x >>> n ) & 1 ) != 0 )