-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelper.java
More file actions
35 lines (27 loc) · 943 Bytes
/
Helper.java
File metadata and controls
35 lines (27 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package utils;
import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;
public class Helper {
public static String lineSeparator() {
return System.getProperty("line.separator");
}
public static void matrixView(int[][] arr) {
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr.length; j++) {
System.out.printf("%3s", arr[i][j]);
}
System.out.println(" ");
}
}
public static void fillMatrix(int[][] array) {
System.out.println("One view way: ");
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array.length; j++) {
array[i][j] = ThreadLocalRandom.current().nextInt(-5, 5);
}
System.out.println(Arrays.toString(array[i]));
}
System.out.println(lineSeparator()+"Another view way: ");
matrixView(array);
}
}