用java实现一种排序,java类实现序列化的方法(二种)? 如在collection框架中,实现比较要实现什么样的接口?答:用插入法进行排序代码如下package test;import .*;class insertsort{arraylist al;public insertsort(int num,int mod){al = new arraylist(num);random rand = new random();tln("the arraylist sort before:");for (int i=0;i
(new integer((int()) % mod + 1));
tln("al["+i+"]="+(i));
}
}
public void sortit()
{
integer tempint;
int maxsize=1;
for(int i=1;i{
tempint = (integer)ve(i);
if(alue()>=((integer)(maxsize-1))alue())
{
(maxsize,tempint);
maxsize++;
tln(ring());
} else {
for (int j=0;j
if
(((integer)(j))alue()>=alue()){(j,tempint);maxsize++;tln(ring());break;}}}}tln("the arraylist sort after:");for(int i=0;i{tln("al["+i+"]="+(i));}}public static void main(string[] args){insertsort is = new insertsort(10,100);it();}}