Originally posted by Ernest Friedman-Hill:

Hi,

Welcome to JavaRanch!

Let's say there are N elements in the set. The powerset of a set contains 2^N elements, so a 32-element set gives rise to a 4-billion element powerset.

Now imagine an N-bit integer. Let each bit in the number represent one specific element **e** in the original set. There is one element **E** in the powerset for each value this integer can take. For each value of the integer, the 1-bits correspond to the elements **e** of the original set that belong to this powerset element **E**, and the 0-bits corresponds to elements not in **E**.

So to print the powerset, you use either a real integer or long, or an array of booleans or any other representation you like of an integer. Then you "count", one value at a time, and for each value of the integer, you compute the corresponding element **E** of the powerset and print it.

I do not understand this.

Thanks for the help anyway.