you must create a function powers
that takes an array, and returns the number of subsets possible to create from that list. In other words, counts the power sets.
For instance powers([1,2,3]) => 8 即求 集合的子集
good example:
public class Powers {
public static BigInteger powers(int[] list){
return BigInteger.valueOf(2).pow(list.length);
}
}
public static BigInteger powers(int[] list) {
return BigInteger.ONE.shiftLeft(list.length);
}