怎么弄都弄不明白 快七窍生烟了 求人帮帮忙
public class guibingpaixu2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] a=new int[10];
for (int i = 0; i < a.length; i++) {
a[i]=(int) (Math.random()*10);
System.out.print(a[i]+" ");
}
System.out.println();
System.out.print("排序后:");
Guibing(a,0,9);
for (int i = 0; i < a.length; i++) {
System.out.print(a[i]+"");
}
}
static void Mer(int a[],int start,int i,int end)
{
int n1, n2;
n1 = i - start + 1;
n2 = end - i;
int[] temp=new int[n1];
int[] temp2=new int[n2];
for (int j = 0; j < n1; j++) {
temp[j]=a[start+j];
}
for (int j = 0; j < n2; j++) {
temp2[j]=a[i+j+1];
}
for (int j = start,k=0,m=0; j <=end; j++) {
if(temp[k]<temp2[m])
{
a[j]=temp[k];
k++;
}
else
{
a[j]=temp2[m];
m++;
}
}
}
static void Guibing(int a[],int start,int end)
{
if(start<end)
{
int i;
i=(end+start)/2;
Guibing(a,start,i);
Guibing(a,i+1,end);
Mer(a,start,i,end);
}
}
}
public class guibingpaixu2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] a=new int[10];
for (int i = 0; i < a.length; i++) {
a[i]=(int) (Math.random()*10);
System.out.print(a[i]+" ");
}
System.out.println();
System.out.print("排序后:");
Guibing(a,0,9);
for (int i = 0; i < a.length; i++) {
System.out.print(a[i]+"");
}
}
static void Mer(int a[],int start,int i,int end)
{
int n1, n2;
n1 = i - start + 1;
n2 = end - i;
int[] temp=new int[n1];
int[] temp2=new int[n2];
for (int j = 0; j < n1; j++) {
temp[j]=a[start+j];
}
for (int j = 0; j < n2; j++) {
temp2[j]=a[i+j+1];
}
for (int j = start,k=0,m=0; j <=end; j++) {
if(temp[k]<temp2[m])
{
a[j]=temp[k];
k++;
}
else
{
a[j]=temp2[m];
m++;
}
}
}
static void Guibing(int a[],int start,int end)
{
if(start<end)
{
int i;
i=(end+start)/2;
Guibing(a,start,i);
Guibing(a,i+1,end);
Mer(a,start,i,end);
}
}
}