原题是 
给定33个数 从33个中选6个(可以重复) 加和等于150  统计有多少种排列方法 JAVA怎么编写啊? 
谁能解答一下 谢谢(考虑 可以根据递归选出符合要求的情况,再将符合要求的数据经过排查放到容器里,可以得到想要的数据)
刚入门 希望高手指教 代码如下
(将数据扩大到1-33的时候就不能正常运行了 不知道为什么)
class HashSetBind implements Set { HashSet hs=new HashSet();

public boolean add(Object o) {
if(this.contains(o))
return false;
else
return hs.add(o);
} public boolean addAll(Collection c) {
return hs.addAll(c);
} public void clear() {
hs.clear();

} public boolean contains(Object o) {

boolean bool=false;
for(Iterator iter = hs.iterator(); iter.hasNext();)
{
intC intct=(intC)iter.next();
int[] intemp=intct.getIntcon();
int[] Oint=((intC)o).getIntcon();
Arrays.sort(intemp);
Arrays.sort(Oint);
if(intemp.length!=Oint.length)
  continue;
else{
bool=true;
for(int i=0;i<intemp.length;i++)
{
if(intemp[i]!=Oint[i])
{
bool=false;
break;
}
}
if(bool)
return true;
}
}
return false;
} public boolean containsAll(Collection c) {

return hs.containsAll(c);
} public boolean isEmpty() {

return hs.isEmpty();
} public Iterator iterator() {

return hs.iterator();
} public boolean remove(Object o) {

return hs.remove(o);
} public boolean removeAll(Collection c) {

return hs.removeAll(c);
} public boolean retainAll(Collection c) {

return hs.retainAll(c);
} public int size() {

return hs.size();
} public Object[] toArray() {

return hs.toArray();
} public Object[] toArray(Object[] a) {

return hs.toArray();
} public HashSet getHs() {
return hs;
}

}class intC {

private int[] intcon; public int[] getIntcon() {
return intcon;
} public void setIntcon(int[] intcon) {
this.intcon = intcon;
}}public class Count33 { /**
 * @param args
 */
static int size = 0;
static HashSetBind vector = new HashSetBind();
static intC ic = new intC(); public static void main(String[] args) { int[] data = { 20, 15, 30, 9, 10, 23, 33, 43, 34, 21, 45, 67, 58};
int length = 6;
int count = 150;
ic.setIntcon(new int[length]);
countAdd(data,length, count,-1,0,0);
int k=0;
for(Iterator ite=vector.getHs().iterator();ite.hasNext();){
ic=(intC)ite.next();
for(int inn:ic.getIntcon())
System.out.print(inn+" ");
System.out.println();
k++;
}
System.out.println(k);
} /*
 * data 原数据
 * length 要选择多少个数据加和
 * count 加和所要求的最后结果
 * in 循环所取得元素
 * index 循环赋值的层数
 * sum 加和的结果
 */
private static void countAdd(int[] data, int length, int count,int in, int index,int sum) {
if(in!=-1){
ic.getIntcon()[index]=data[in];
sum += data[in];
index++;
if (index == length && sum == count) {
/*
 * 把符合要求的数据放到vector中
 */
intC icn=new intC();
int[] inttemp=ic.getIntcon();
int[] intCopy=new int[inttemp.length];
for(int i=0;i<inttemp.length;i++)
{
intCopy[i]=inttemp[i];
}
icn.setIntcon(intCopy);
vector.add(icn);
}
}
for (int i = 0; i < data.length; i++) {
if(index==length)
break;
else
countAdd(data,length,count,i,index,sum);
}
}