@@ -40,6 +40,16 @@ public static void printTwoDmBooleanArray(boolean[][] theArray) {
40
40
}
41
41
}
42
42
43
+ public static void printTwoDmIntArray (int [][] theArray ) {
44
+
45
+ for (int [] rows : theArray ) {
46
+ for (int cols : rows ) {
47
+ System .out .printf ("[%d] " , cols );
48
+ }
49
+ System .out .println ();
50
+ }
51
+ }
52
+
43
53
/**
44
54
* static method that returns the transposition of an input matrix
45
55
* */
@@ -60,7 +70,6 @@ public static int[][] matrixTransposition(int[][] theMatrix) {
60
70
61
71
public static void main (String [] args ) {
62
72
Random generator = new Random ();
63
- int i = 0 ;
64
73
65
74
double testX = 0.1 ;
66
75
double testY = 0.5 ;
@@ -75,11 +84,10 @@ public static void main(String[] args) {
75
84
testTwoDmBooleanArray [2 ][0 ] = true ;
76
85
testTwoDmBooleanArray [2 ][1 ] = false ;
77
86
78
- for (int [] rows : testIntMatrix ) {
79
- for (int cols : rows ) {
80
- testIntMatrix [i ][cols ] = generator .nextInt (10 );
87
+ for (int i = 0 ; i < testIntMatrix . length ; i ++ ) {
88
+ for (int j = 0 ; j < testIntMatrix [ i ]. length ; j ++ ) {
89
+ testIntMatrix [i ][j ] = generator .nextInt (10 );
81
90
}
82
- i ++;
83
91
}
84
92
85
93
System .out .println (isBetweenZeroAndOne (testX , testY ));
@@ -88,5 +96,6 @@ public static void main(String[] args) {
88
96
89
97
printTwoDmBooleanArray (testTwoDmBooleanArray );
90
98
System .out .println ();
99
+ printTwoDmIntArray (testIntMatrix );
91
100
}
92
101
}
0 commit comments