Here you can find the source of and(byte[] a, byte[] b)
Parameter | Description |
---|---|
a | a parameter |
b | a parameter |
public static byte[] and(byte[] a, byte[] b)
//package com.java2s; /**/*from w ww .jav a 2s.co m*/ * ?????????? unsigned ???????????????????????????????????????? * * License : MIT License */ public class Main { /** * a & b * @param a * @param b * @return */ public static byte[] and(byte[] a, byte[] b) { if (a == null) throw new IllegalArgumentException("a should not be null"); if (b == null) throw new IllegalArgumentException("b should not be null"); if (a.length != b.length) throw new IllegalArgumentException( "byte array length should be same"); int len = a.length; byte[] result = new byte[len]; for (int i = 0; i < len; i++) { result[i] = (byte) ((a[i] & b[i]) & 0x000000ff); } return result; } }