打包实践;
import java.util.ArrayList;
import java.util.List;
公共类测试1 {
//*
publicstaticvoidmain{
//todo自动- generated method stub
objectqfdmntmp={ 1,2,3,4,5,6 };
//ArrayList RS=随机(tmp );
for(intI=0; I
{
//system.out.print(I'=';
for(intj=0; Jj
{
}
}
}
//求出数组的任意组合
静态随机存取存储器(objectqfdmnsource ) ) )。
{
if(source.Length==1) ) )。
{
result.add(source;
}
else
{
objectqfdmnpsource=new object [ source.length-1 ];
for(intI=0; I
{
psource[i]=source[i];
}
result=随机源(p source );
int len=result.size (; //fn组合的长度
result.add((newobjectqfdmn ) source[source.Length-1] );
for(intI=0; I
{
objectqfdmntmp=new object [ result.get (I ).length 1]
for(intj=0; Jj
{
tmp[j]=result.get(i;
}
tmp [ tmp.length-1 ]=source [ source.length-1 ];
result.add(tmp;
}
}
返回结果;
}
静态随机存取存储器(objectqfdmnsource,int n ) )。
{
if(n==1) )。
{
for(intI=0; I
{
result.add (newobjectqfdmn { source [ I ] };
}
}
(Elseif(source.Length==n ) ) ) ) ) ) ) )。
{
result.add(source;
}
else
{
objectqfdmnpsource=new object [ source.length-1 ];
for(intI=0; I
{
psource[i]=source[i];
}
结果=cmn (p source,n );
for(intI=0; I
{
Objectqfdmn rs=new Object[n];
for(intj=0; Jj
{
RS[j]=tmp.get[I][j];
}
RS [ n-1 ]=source [ source.length-1 ];
result.add(RS;
}
}
返回结果;
}
}