for (double[] row: matrix)
Arrays.fill(row, 1.0);
//this way u can fill your array row by row
Scanner input = new Scanner(System.in);
for (int i = 0; i < row; i++){
for (int j = 0; j < column; j++){
array[i][j] = input.nextInt();
}
}
//this way u can fill your array column by column
//Scanner input = new Scanner(System.in);
for (int i = 0; i < column; i++){
for (int j = 0; j < row; j++){
array[i][j] = input.nextInt();
}
}
int a[100000][100000];
std::fill((int*)a,(int*)a+sizeof(a)/sizeof(int),0);
// To fill two dimenional array with some simbol, e.g. "*"
Scanner scanner = new Scanner(System.in);
int number = scanner.nextInt();
String[][] matrix = new String[number][number];
for (String[] strings : matrix) {
Arrays.fill(strings, ".");
}
// To modify only middle and/or diagonales:
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
if (i == number / 2) {
matrix[i][j] = "*";
}
if (j == number / 2) {
matrix[i][j] = "*";
}
if (i == j) {
matrix[i][j] = "*";
}
if (i == number - j - 1) {
matrix[i][j] = "*";
}
}
}
/*
Result:
* . . * . . *
. * . * . * .
. . * * * . .
* * * * * * *
. . * * * . .
. * . * . * .
* . . * . . *
*/