Skip to content

Commit 2871c44

Browse files
committed
FEAT Implemented method to print formatted contents of a boolean matrix
1 parent 4dd378e commit 2871c44

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/PracticeAlgorithms.java

+25-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,36 @@ private static String binaryFormString(int x, String binString) {
1616
return binaryFormString(x / 2, binString) + (x % 2);
1717
}
1818

19+
public static void printTwoDmBooleanArray(boolean[][] theArray) {
20+
for (boolean[] row : theArray) {
21+
for (boolean column : row) {
22+
if (column) {
23+
System.out.print("*");
24+
} else {
25+
System.out.print(" ");
26+
}
27+
}
28+
System.out.println();
29+
}
30+
}
31+
1932
public static void main(String[] args) {
2033
double testX = 0.1;
2134
double testY = 0.5;
2235

23-
System.out.println(isBetweenZeroAndOne(testX, testY));
36+
boolean[][] testTwoDmBooleanArray = new boolean[3][2];
2437

38+
testTwoDmBooleanArray[0][0] = true;
39+
testTwoDmBooleanArray[0][1] = false;
40+
testTwoDmBooleanArray[1][0] = false;
41+
testTwoDmBooleanArray[1][1] = true;
42+
testTwoDmBooleanArray[2][0] = true;
43+
testTwoDmBooleanArray[2][1] = false;
44+
45+
System.out.println(isBetweenZeroAndOne(testX, testY));
2546
System.out.println(toBinaryString(8));
47+
System.out.println();
48+
49+
printTwoDmBooleanArray(testTwoDmBooleanArray);
2650
}
2751
}

0 commit comments

Comments
 (0)