我n年前上学用的,你看看把,呵呵。希望对你有帮助
public class Test
{
public void Sx(int[] t)
{
for(int i = 0;i < t.length;i++)
{
if(t[i] < 10)
{
System.out.print("0"+t[i]+" ");
}
else
{
System.out.print(t[i]+" ");
}
if((i+1) % 6 == 0)
{
System.out.println();
}
}
}
public static void main(String[] args)
{
Test m = new Test();
int a[] = new int[36];
out1: for(int i = 0;i < 36;i++)
{
a[i] = (int)(Math.random() * 36 + 1);
for(int j = 0; j < 36 && j != i;j++)
{
if(a[j] == a[i])
{
i--;
continue out1;
}
}
}
m.Sx(a);
System.out.println();
//Arrays.sort(a);
//冒泡法
int temp;
for(int i=0;i
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
m.Sx(a);
}
}