2016-12-05 22:15:40 +01:00
|
|
|
public class PrintIdentityMatrix {
|
2013-04-10 21:29:02 -07:00
|
|
|
|
2016-12-05 22:15:40 +01:00
|
|
|
public static void main(String[] args) {
|
|
|
|
|
int n = 5;
|
|
|
|
|
int[][] array = new int[n][n];
|
|
|
|
|
|
|
|
|
|
IntStream.range(0, n).forEach(i -> array[i][i] = 1);
|
|
|
|
|
|
|
|
|
|
Arrays.stream(array)
|
|
|
|
|
.map((int[] a) -> Arrays.toString(a))
|
|
|
|
|
.forEach(System.out::println);
|
|
|
|
|
}
|
2013-04-10 21:29:02 -07:00
|
|
|
}
|