This code below generates subset of a given set. Its simple and stupid. Can anyone find a better way of doing it...
package DiscreateTut;
import java.lang.Character.Subset;
import java.util.Vector;
public class ShowSubset {
/**
* @param args
*/
static String[] Set= {"a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","a11","a12" };
public static void main(String[] args) {
// TODO Auto-generated method stub
String nullSet="";
String intset=Set[0];
Vector subset = new Vector();
Vector tempSubset=new Vector();
subset.addElement(nullSet);
int x=1;
System.out.println("Start of array");
for(int i=0;i
for (int j=0;j
System.out.println(x+" = "+subset.get(j).toString()+","+Set[i]);
x++;
tempSubset.addElement(subset.get(j).toString()+","+Set[i]);
}
subset.addAll(tempSubset);
tempSubset.clear();
}
}
}
No comments:
Post a Comment