title: Can any one give me better solution for merging two sorted arrays into another sorted array
body: <pre><code>public static void main(String[] args) {
          // TODO Auto-generated method stub
          int[] arrA = {2,3,4};
          int[] arrB = {5,6,7,8};
          mergeArray(arrA,arrB);
      }
      static void mergeArray(int[] arrA,int[] arrB){
  
          int len = arrA.length+arrB.length;
          int lenA = arrA.length;
          int lenB = arrB.length;
          int a=0,b=0,c=0;
          int temp=0;
          int[] arrC = new int[len];
          for(int i=0; i &lt; lenA; i++){
              arrC[i] = arrA[i];
          }
          for(int j=lenA,k=0; (k &lt; lenB) &amp;&amp; (j &lt; len) ; j++,k++){
              arrC[j] = arrB[k];
          }
          for(int n=0; n &lt; len ; n++){
              for(int m=0; m &lt; len; m++ ){
                  if(arrC[n] &lt; arrC[m]){
                      temp  = arrC[n];
                      arrC[n] = arrC[m];
                      arrC[m] = temp;
                  }
              }
          }
          for(int x : arrC){
              System.out.println(x);
          }
      }
  </code></pre>
  
  <p>Result: {2,3,4,5,6,7,8}</p>
  
  <p>I am trying to put the values into one new array and sorting them again.Can any one give me better solution than this.</p>