Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Matrix1 {
- private boolean[][] a;
- private boolean[][] b;
- //private boolean[][] c;
- private boolean[][] c = new boolean [3][3];
- //private boolean[][] c = {{false, false, false}, {true, true, true}, {false, true, true}};
- public Matrix1 (boolean[] [] a, boolean[] [] b)
- {
- this.a = a;
- this.b = b;
- }
- public boolean [][] multiplyMatrix(boolean[][] a, boolean[][] b, boolean[][] c) {
- this.a = a;
- this.b = b;
- this.c = c;
- for (int i = 0; i < a.length; i++) {
- for (int j = 0; j < a.length; j++) {
- for (int k = 0; k < a.length; k++) {
- c[i][j] = c[i][j] & (a[i][k] | b[k][j]);
- //c[i][j] = true;
- }
- }
- }
- return c;
- }
- public String toString () {
- String str = "";
- int l, n;
- for (l = 0; l < a.length; l++)
- {
- for (n = 0; n < a.length; n++)
- {
- str = str + " " + c[l][n];
- }
- str = str+ "\n";
- }
- return str;
- }
- }
- public class Test {
- public static void main(String[] args) {
- boolean [][] aa = {{true, true, true}, {true, true, true}, {true, true, true}};
- boolean [][] bb = {{true, true, true}, {true, true, true}, {true, true, true}};
- Matrix1 m = new Matrix1 (aa, bb);
- System.out.println(m);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement