title: print either int or double with selfmade print method in java
body: <p>I have a programm that creates 2D arrays of ints and double (some are int, some are double). I wrote a method to print those arrays as a map to the console. But instead of having two methods for int and double each, i wondered if its possible to accept both int and double as a parameter.</p>
  
  <p>This is my print function:</p>
  
  <pre><code>private void printMap(int map[][]){
      for (int i=0; i&lt;map.length;i++){
          for (int j=0; j&lt;map[i].length;j++){
              if(map[i][j]&lt;1000)System.out.print(" ");
              if(map[i][j]&lt;100)System.out.print(" ");
              if(map[i][j]&lt;10)System.out.print(" ");
              System.out.print(imap[i][j]+" ");
          }
          System.out.println("");
      }   
  }
  </code></pre>
  
  <p>Right now i have 2 times the same except for the params, like:</p>
  
  <pre><code>    private void print_intMap(int map[][]){..}
      private void print_doubleMap(double map[][]){..}
  </code></pre>
  
  <p>and I want it to be like</p>
  
  <pre><code>    private void printMap(/*either int or double*/){..}
  </code></pre>
  
  <p>Any ideas?
  thx in advance</p>