title: Java, two dimensional array sort
body: <p>I'm quite new to Java, but getting into it. However, I can't wrap my head around why this example, which I found here, does not work: </p>
  
  <p>At start of class: </p>
  
  <pre><code>String[][] spritesPaint = new String[20][20];
  </code></pre>
  
  <p>In method:</p>
  
  <pre><code>for (int funct1 = 0; funct1 &lt;= 2; funct1++) {
      if (funct1 == 0) {
          for (int funct2 = 0; funct2 &lt; rEnemyNumber; funct2++) {
              spritesPaint[0][funct2] = new Integer(rEnemyY[funct2])
                      .toString();
              spritesPaint[1][funct2] = rEnemyGraphic[funct2];
          }
      } else if (funct1 == 1) {
          Arrays.sort(Integer.valueOf(spritesPaint[0].toString()),
                  new Comparator&lt;Integer[]&gt;() {
                      @Override
                      public int compare(final Integer[] entry1,
                              final Integer[] entry2) {
                          final Integer time1 = entry1[0];
                          final Integer time2 = entry2[0];
                          return time1.compareTo(time2);
                      }
                  });
  
      } else if (funct1 == 2) {
          for (int funct3 = 0; funct3 &lt; rEnemyNumber; funct3++) {
              if (rEnemyCheck[funct3] == true) {
                  nextPaint = getImage(base, rEnemyGraphic[funct3]);
                  System.out.println("Next: " + nextPaint);
  
                  g.drawImage(nextPaint, rEnemyX[funct3] + worldCenterX,
                          rEnemyY[funct3] + worldCenterY, this);
              }
          }
      }
  }
  </code></pre>
  
  <p>Basically, what I want to do is have a two dimensional array where I store Y position of object on the screen and an image path also related to that object, then sort it by the Y position integer. This should allow me to paint elements to the screen in the correct order for an isometric perspective.</p>
  
  <p>However, I keep getting this error: </p>
  
  <pre><code>The method sort(T[], Comparator&lt;? super T&gt;) in the type Arrays 
  is not applicable for the arguments (Integer, new Comparator&lt;Integer[]&gt;(){})
  </code></pre>
  
  <p>Please help me, I've been twisting my brain for hours trying to understand why I get this error now.</p>