Here you can find the source of and(byte[] a, int offsetA, byte[] b, int offsetB, byte[] dst, int dstOffset, int length)
Parameter | Description |
---|---|
a | the first array |
offsetA | the offset into the a array at which to start ANDing values |
b | the second array |
offsetB | the offset into the b array at which to start ANDing values |
dst | the destination array to store the ANDed results in |
dstOffset | the offset into the dst array at which to start storing the ANDed values |
length | the number of values to read from a and b and store in dst |
public static final void and(byte[] a, int offsetA, byte[] b, int offsetB, byte[] dst, int dstOffset, int length)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w. j a v a 2 s . c o m * @return a newly created array containing the ANDed results of {@code a} and {@code b} * @see ArrayUtil#and(byte[], int, byte[], int, byte[], int, int) and() */ public static final byte[] and(byte[] a, byte[] b) { byte[] dst = new byte[a.length]; and(a, 0, b, 0, dst, 0, dst.length); return dst; } /** * @see ArrayUtil#and(byte[], int, byte[], int, byte[], int, int) and() */ public static final void and(byte[] a, byte[] b, byte[] dst, int length) { and(a, 0, b, 0, dst, 0, length); } /** AND {@code length} number of bytes from {@code a} with {@code b} using the syntax ({@code a[i] & b[i]}) * and store the result in {@code dst} * @param a the first array * @param offsetA the offset into the {@code a} array at which to start ANDing values * @param b the second array * @param offsetB the offset into the {@code b} array at which to start ANDing values * @param dst the destination array to store the ANDed results in * @param dstOffset the offset into the {@code dst} array at which to start storing the ANDed values * @param length the number of values to read from {@code a} and {@code b} and store in {@code dst} */ public static final void and(byte[] a, int offsetA, byte[] b, int offsetB, byte[] dst, int dstOffset, int length) { for (int i = 0, aI = offsetA, bI = offsetB, dstI = dstOffset; i < length; i++, aI++, bI++, dstI++) { dst[dstI] = (byte) (a[aI] & b[bI]); } } }