merge and sort 2 arrays

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { Main mammoth = new Main(); System.out.println("Hello World!"); int[] a = {0,3,4,31}; int[] b = {4,6,30}; mammoth.mergearray(a,b); } public void mergearray(int a[], int b[] ) { int temp=0; int[] c = new int[20]; for(int i=0;i<a.length;i++) { c[i]=a[i]; } int r = a.length; for(int t = 0;t<b.length;t++){ c[r]=b[t]; r++; if(t==b.length-1){ break; } } int lenner = a.length + b.length; for(int x=0;x<lenner-1;x++) { for(int y =x+1 ; y<lenner;y++){ { if(c[x]>c[y]){ temp = c[x]; c[x]=c[y]; c[y]=temp; } } } } for(int apple =0; apple<lenner;apple++){ System.out.print(" "+c[apple]); } } }
Editor Settings
Theme
Key bindings
Full width
Lines