Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy am I getting this results in my ArrayList instead of the integer values?
    text
    copied!<p>Hello and Thanks for all your peoples help.</p> <p>I am making a concentration game as a learning project. I was having some problems with the random generator working right which was solved by Jeeter in this thread. <a href="https://stackoverflow.com/questions/19827533/how-to-create-a-number-generator-that-will-only-pick-a-number-1-time" title="Jeeter&#39;s Solution">Jeeter's Solution</a></p> <p>and this is the code which I am using to get the numbers and store them into an ArrayList</p> <pre><code>ArrayList&lt;int[]&gt; al = new ArrayList&lt;int[]&gt;(); int offsetX = 130; int offsetY = 100; switch(Game.difficulity){ case EASY: GameConstants.cardsToDraw = 6; //generate cards UniqueRandoms randpEA = new UniqueRandoms(GameConstants.cardsToDraw); int[] cardsEA = new int[GameConstants.cardsToDraw]; System.out.print("The Picks are: "); //Testing purposes only. for (int i = 0; i &lt; GameConstants.cardsToDraw; i++) { cardsEA[i] = randpEA.nextInt(); // grabs the results so they can be manulipated al.add(cardsEA); // add the results to an ArrayList System.out.print(cardsEA[i] + ", "); //testing to see what is chosen // this line just shows the result as cards onscreen. handler.addcard(new GameCard((offsetX) + i*90, (GameConstants.CENTER_Y - offsetY), cardsEA[i], res)); } //end of generate cards System.out.print("\n"); System.out.println("Contents of al: " + al); Game.state = GameState.EASY_GAME; break; </code></pre> <p>This is the easy code block to keep this post short.</p> <p>the results are this when I run the program:<br/> Cards to draw: 6<br/> The Picks are: 5, 2, 4, 1, 3, 6,<br/> Contents of al: [[I@44d74990, [I@44d74990, [I@44d74990, [I@44d74990, [I@44d74990, [I@44d74990]<br/></p> <p>What my question is why am I getting the crazy numbers instead of the actual integers and how can I fix this?</p> <p>Because I have to do the following: </p> <ol> <li>Store the results</li> <li>Duplicate the results</li> <li>Shuffle the ArrayList</li> <li>retrieve the values when I need to use them</li> </ol> <p>So far I am trying to store the results and it does not look like it doing what I expect and then I have to figure out how to duplicate the results in the ArrayList.</p> <p>My GitHub Project:<a href="https://github.com/rtester47/Concentration" rel="nofollow noreferrer" title="Here">Here</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload