title: Swapping adjacent numbers in arrays
body: <p>Here's the problem: Write a method called swapPairs that accepts an array of integers and swaps the elements at adjacent indexes.  That is, elements 0 and 1 are swapped, elements 2 and 3 are swapped, and so on.  If the array has an odd length, the final element should be left unmodified.  For example, the list {10,20,30,40,50} should become {20,10,40,30,50} after a call to your method. </p>
  
  <p>Write method printArray that is passed an array and will print out each element.<br>
  Use this method to print the array modified by swapPairs.</p>
  
  <p>This is my code:</p>
  
  <pre><code>public static void swapPairs(int[] a){
      int len=a.length;
          if(len%2 ==0){
              for(int i=0; i&lt;len; i=i+2){
                  a[i]=a[i+1];
                  a[i+1]=a[i];
                  int[] b={a[i]+a[i+1]};
              }   
          }
          if(len%2 !=0){
              for(int j=0; j&lt;len; j=j+2){
                  a[j]=a[j+1];
                  a[j+1]=a[j];
                  a[len-1]=a[len-1];
                  int[] b={a[j]+a[j+1]+a[len-1]};
              }
          }   
  }
  public static void printArray(int[] a){
      System.out.println(a);
  }
  </code></pre>
  
  <p>However, what it returns is [I@2a139a55</p>