// This is the usual shorthand way to initialise a matrix. int[][] mat = new int[3][5]; for ( int i=0; i<3; i++ ) { for ( int j=0; j<5; j++ ) { mat[i][j] = i*j+100; } }