Java xor xor(boolean a[], boolean b[])

Here you can find the source of xor(boolean a[], boolean b[])

Description

Computes vector whose elements are the results of logical XOR of the respective elements in the two given vectors.

License

Open Source License

Parameter

Parameter Description
a the first vector
b the second vector

Return

the vector containing logical XORs of the elements of the two given vectors

Declaration

public static boolean[] xor(boolean a[], boolean b[]) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*w w w. ja  v  a2  s  . co  m*/
     * Computes vector whose elements are the results of logical XOR of the respective
     * elements in the two given vectors.
     * @param a the first vector
     * @param b the second vector
     * @return the vector containing logical XORs of the elements of the two given vectors
     */
    public static boolean[] xor(boolean a[], boolean b[]) {
        boolean[] c = new boolean[a.length];
        for (int i = 0; i < c.length; i++) {
            c[i] = a[i] ^ b[i];
        }
        return c;
    }
}

Related

  1. xor(boolean a, boolean b)
  2. xor(boolean b1, boolean b2)
  3. xor(boolean b1, boolean b2)
  4. xor(boolean o, boolean t)
  5. xor(boolean val1, boolean val2)