Java Bitwise And bitAnd(byte[] a, byte[] b)

Here you can find the source of bitAnd(byte[] a, byte[] b)

Description

bit And

License

Open Source License

Declaration

public static byte[] bitAnd(byte[] a, byte[] b) 

Method Source Code

//package com.java2s;
/* *****************************************************************************
 * Copyright (c) 2007-2008 Bioclipse Project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from   w  w  w .  j  a  v  a  2s .co  m*/
 *     
 *******************************************************************************/

public class Main {
    public static byte[] bitAnd(byte[] a, byte[] b) {
        byte[] result = new byte[a.length];
        for (int i = 0; i < result.length; i++) {
            result[i] = (byte) (a[i] & b[i]);
        }
        return result;
    }
}

Related

  1. bitAnd(Byte a, Byte b)
  2. bitwiseAnd(int arg0, int arg1)
  3. bitwiseAndByteArrays(byte[] arr0, byte[] arr1)