title: java.lang.ClassCastException: class [I cannot be cast to class java.lang.Comparable
body: <p>so first of all: I do realize that my code is a complete mess... and i apologize for that
  I also looked at multiple other threads, but couldn't find anything that helped me or i was able to understand at least.</p>
  <p>I will split it up in Multiple Parts:
  First of all: <strong>The full Error Message</strong></p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.ClassCastException: class [I cannot be cast to class java.lang.Comparable ([I and java.lang.Comparable are in module java.base of loader 'bootstrap')
      at java.base/java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:320)
      at java.base/java.util.ComparableTimSort.sort(ComparableTimSort.java:188)
      at java.base/java.util.Arrays.sort(Arrays.java:1040)
      at Bingo.bingo(Bingo.java:77)
      at Bingo.main(Bingo.java:17)
  </code></pre>
  <p>Nextup: <strong>The Full Code</strong></p>
  <pre><code>import java.util.Arrays;
  
  public class Bingo{
  
    public static void main (String[] args){
  
      //bingo(zeilen, spalten, minWert, maxWert, keineDoppelten?);
      bingo(5,5, 1,99, true);
  
    }
  
    public static void bingo(int zeilen, int spalten, int min, int max, boolean keineDoppelten){
  
      //Karte des Spielers:
      int [] [] bingokarte;
      bingokarte = new int [zeilen] [spalten];
  
      int [][] tempArray;
      tempArray = new int [zeilen] [spalten];
  
      int y = 0;
      boolean checkForMultiples = false;
      int randomTemp;
  
      //Den Inhalt des Karten-Arrays generieren: (ohne sich wiederholende Zahlen als option)
  
      int anzahlFelder = zeilen * spalten;
      int zahlenBereich = max - min;
  
      if(keineDoppelten == true &amp;&amp; zahlenBereich &lt; anzahlFelder){
  
          System.out.println(&quot;Bitte geben Sie einen Zahlen bereich, der weiter als &quot; + anzahlFelder + &quot; an! Ihr momentaner Zahlenbereich umfasst &quot; + zahlenBereich + &quot;.&quot;);
  
          System.exit(0);
  
      }
  
  
      else if (keineDoppelten){
  
        for (int i = 0; i &lt; zeilen ; i++) {
  
          for(int j = 0; j &lt; spalten; j ++){
  
            randomTemp = (int)(Math.random() * ((max - min) + 1)) + min;
  
            tempArray = bingokarte;
            Arrays.sort(bingokarte);
  
            if(Arrays.binarySearch(bingokarte, randomTemp) &gt;= 0){
  
              checkForMultiples = true;
  
              while(checkForMultiples == true)
  
                randomTemp = (int)(Math.random() * ((max - min) + 1)) + min;
                tempArray = bingokarte;
                Arrays.sort(bingokarte);
  
                if(Arrays.binarySearch(bingokarte, randomTemp) &gt;= 0){
  
                  checkForMultiples = true;
  
                }
  
                else{
  
                  checkForMultiples = false;
                  bingokarte[i][j] = randomTemp;
  
                }
  
              }
  
              else{
  
                bingokarte[i][j] = randomTemp;
  
              }
  
            }
  
          }
  
      }
  
  
      else{
  
          for (int i = 0; i &lt; zeilen ; i++) {
  
              for(int j = 0; j &lt; spalten; j ++){
  
                bingokarte[i][j] = (int)(Math.random() * ((max - min) + 1)) + min;
  
              }
  
          }
  
      }
  
  
      //Ausgabe:
  
      int laengeDerZeilenPlusAbstandszeilen = zeilen * 2 + 1;
      int laengeDerSpaltenPlusAbstandszeilen = spalten * 5 + 2;
  
      for (int i = 0; i &lt; laengeDerZeilenPlusAbstandszeilen; i++) {
  
        if (i%2 == 0) {
  
          for(int a = 0; a &lt; laengeDerSpaltenPlusAbstandszeilen; a++){
  
            if(a &lt; 1){
              System.out.print(&quot; &quot;);
            }
  
            else{
              System.out.print(&quot;-&quot;);
            }
  
          }
  
          System.out.print(&quot;\n&quot;);
  
        }
  
        else{
  
          System.out.print(&quot; | &quot;);
  
          for (int x = 0; x &lt; spalten; x++) {
  
            if(bingokarte[x][y] &lt; 10){
  
              System.out.print(&quot; &quot; + bingokarte[x][y] + &quot; | &quot;);
  
            }
  
            else{
  
              System.out.print(bingokarte[x][y] + &quot; | &quot;);
  
            }
  
          }
  
          System.out.print(&quot;\n&quot;);
  
          y++;
  
        }
  
      }
  
    }
  
  }
  
  </code></pre>
  <p><strong>And now here are the parts of the Code that are giving me a headache on their own:</strong></p>
  <pre><code>    else if (keineDoppelten){
  
        for (int i = 0; i &lt; zeilen ; i++) {
  
          for(int j = 0; j &lt; spalten; j ++){
  
            randomTemp = (int)(Math.random() * ((max - min) + 1)) + min;
  
            tempArray = bingokarte;
            Arrays.sort(bingokarte);
  
            if(Arrays.binarySearch(bingokarte, randomTemp) &gt;= 0){
  
              checkForMultiples = true;
  
              while(checkForMultiples == true)
  
                randomTemp = (int)(Math.random() * ((max - min) + 1)) + min;
                tempArray = bingokarte;
                Arrays.sort(bingokarte);
  
                if(Arrays.binarySearch(bingokarte, randomTemp) &gt;= 0){
  
                  checkForMultiples = true;
  
                }
  
                else{
  
                  checkForMultiples = false;
                  bingokarte[i][j] = randomTemp;
  
                }
  
              }
  
              else{
  
                bingokarte[i][j] = randomTemp;
  
              }
  
            }
  
          }
  
      }
  </code></pre>
  <p><em>I would be very glad if u could help me out! Thanks!</em></p>