code: public Collection<Range> getBits(boolean value) {
          int index=0;
          int start_range=0, end_range=0;
          int size=(int)((high - low) + 1);
          final Collection<Range> retval=new ArrayList<>(size);
  
          while(index < size) {
              start_range=value? bits.nextSetBit(index) : bits.nextClearBit(index);
              if(start_range < 0 || start_range >= size)
                  break;
              end_range=value? bits.nextClearBit(start_range) : bits.nextSetBit(start_range);
              if(end_range < 0 || end_range >= size) {
                  retval.add(new Range(start_range + low, size-1+low));
                  break;
              }
              retval.add(new Range(start_range + low, end_range-1+low));
              index=end_range;
          }
  
          return retval;
      }
docs: Returns ranges of all bit set to value
  @param value If true, returns all bits set to 1, else 0
  @return