title: Is it possible to override an integer array in Java?
body: <p>I have an ArrayList <code>ArrayList&lt;int[]&gt;</code> which has one-dimensional array of integers as it's members.</p>
  
  <p>When I am debugging and have my watch set on <code>tmp</code> from the code below, I want to be able to see <code>tmp</code>'s contents, which means I have to override the <code>toString</code> method of <code>int[]</code>?</p>
  
  <p>At the moment, I am able to see my contents by printing them out using the <code>print</code> method below. However, I do not want to do that ideally, and would like to see the contents of <code>tmp</code> and it's members from the debugger.</p>
  
  <p>PS : I do not want to have debug watch expressions like, say, <code>tmp.get(0)[0]</code> etc</p>
  
  <pre><code>public class TryPrinting {
      public static void main( String[] args ) {
          int[][] people = { {7,0}, {7,1}, {6,1}, {5,0}, {5,2}, {4,4} };
  
          TryPrinting obj = new TryPrinting();
          obj.test( people );
      }
  
      public void test( int[][] people)
      {
          int n = people.length;
          ArrayList&lt;int[]&gt; tmp = new ArrayList&lt;&gt;();
          for (int i = 0; i &lt; n; i++)
          {
              tmp.add(people[i][1], new int[]{people[i][0], people[i][1]});
  
              print( tmp );//This works
              System.out.println( tmp );//But I want this to work
              System.out.println( "" );
          }
  
      }
  
      /* print al */
      public void print( ArrayList&lt;int[]&gt; al )
      {
          for(int i = 0;i&lt;al.size();i++)
          {
              print( al.get( i ) );
          }
          System.out.println( "" );
      }
  
      /* print 1d array */
      public void print(int[] a)
      {
          for(int i = 0;i&lt;a.length;i++)
              System.out.print( a[i] + " " );
      }
  }
  </code></pre>