# \[Java\] Two dimensional array

**URL:** <https://forum.kirupa.com/t/java-two-dimensional-array/316152>\
**Category:** programming\
**Created:** [November 14, 2010, 3:21pm UTC](https://forum.kirupa.com/t/java-two-dimensional-array/316152 "2010-11-14T15:21:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![glundy](https://avatars.discourse-cdn.com/v4/letter/g/3d9bf3/32.png) [@glundy](https://forum.kirupa.com/u/glundy)\
**Post date:** [November 14, 2010, 3:21pm UTC](https://forum.kirupa.com/t/java-two-dimensional-array/316152/1 "2010-11-14T15:21:05Z")

</div>

I am very new to java and the following assignment has been set for me. Can someone please help me?

[LIST=1]  
[_] **Empirical shuffle check.** Run computational experiments to check that our shuffling code works as advertised. Write a program ShuffleTest that takes command-line arguments M and N, does N shuffles of an array of size M that is initialized with a_ = i before each shuffle, and prints an M-by-M table such that row i gives the number of times i wound up in position j for all j. All entries in the array should be close to N/M.  
[/LIST]I have written a program but my output is a M by M table filled with zeros :-

```auto
 
public class ShuffleTest {
    public static void main(String[] args) {
 
        int M = Integer.parseInt(args[0]);
        int N = Integer.parseInt(args[1]); 
        int [] deck = new int [M];
 
        for (int i = 0; i < M; ++i)
         deck * = i;
         int [][] a = new int [M][M];
 
         for (int i = 0; i < M; i++) {
           for (int j = 0; j < M; j++) {
             a*[j] = 0 ;
        for(int n = 0; n < N; n++) {
            int r = i + (int)(Math.random() * (M-i));
            int t = deck[r];
            deck[r] = deck*;
            deck* = t;
 
 
        for (int b = 0; b < N; b++)
{
        for (int c = 0; c < M; c++)
           System.out.print(" " + a**[c]);
           System.out.println();
}
 
}}}}}

```
