code: static int[] toArray(long set) {
  
          int[] vertices = new int[Long.bitCount(set)];
          int i = 0;
  
          // fill the cyclic vertices with the bits that have been set
          for (int v = 0; i < vertices.length; v++) {
              if (isBitSet(set, v)) vertices[i++] = v;
          }
  
          return vertices;
      }
docs: Convert the bits of a {@code long} to an array of integers. The size of
  the output array is the number of bits set in the value.
  
  @param set value to convert
  @return array of the set bits in the long value