int[][] mat; // for each row, allocate a slot for a pointer to an array mat = new int [100][]; for ( int i=0; i<100; i++ ) { // allocate an array for each row mat[i] = new int [i+1]; for ( int j=0; j<=i; j++ ) { mat[i][j] = i * j + 100; } }