1、两个有序数组合并为一个数组主程序代码;public class MergeApppublic static void merge(int arrayA,int sizeA,int arrayB, int sizeB,int arrayC)int adex=0,bdex=0,cdex=0;while(adexsizeA else arrayCcdex+=arrayBbdex+;while(adexsizeA)arrayCcdex+=arrayAadex+;while(bdexsizeB)arrayCcdex+=arrayBbdex+;public static void display(int
2、theArray, int size)for(int j=0;jsize;j+)System.out.print(theArrayj+“ “);public static void main(String args) int arrayA=23,47,81,95;int arrayB=7,14,39,55,62,74;int arrayC=new int10;merge(arrayA,4,arrayB,6,arrayC);display(arrayC,10);测试类:import java.util.*;public class txtpublic static void main(Strin
3、g args) Scanner reader=new Scanner(System.in);int sizeA=reader.nextInt();int arrayA=new int sizeA;for(int i=0;isizeA;i+)arrayAi=reader.nextInt();System.out.println();int sizeB=reader.nextInt();int arrayB=new int sizeB; for(int i=0;isizeB;i+)arrayBi=reader.nextInt();System.out.println();int sizeC=sizeA+sizeB;int arrayC=new int sizeC;while(sizeCsizeA isizeC;i+)if(arrayAiarrayBi)arrayCi+=arrayAi+;else arrayCi+=arrayBi+;int i=0;while(arrayC.lengthsizeA)arrayCi+=arrayAi+;while(arrayC.lengthsizeB)arrayCi+=arrayBi+;for(i=0;isizeC;i+)System.out.print(arrayCi+t);