MCPcopy
hub / github.com/zxing/zxing / toBytes

Method toBytes

core/src/main/java/com/google/zxing/common/BitArray.java:277–288  ·  view source on GitHub ↗

@param bitOffset first bit to start writing @param array array to write into. Bytes are written most-significant byte first. This is the opposite of the internal representation, which is exposed by #getBitArray() @param offset position in array to start writing @param numBytes how many byte

(int bitOffset, byte[] array, int offset, int numBytes)

Source from the content-addressed store, hash-verified

275 * @param numBytes how many bytes to write
276 */
277 public void toBytes(int bitOffset, byte[] array, int offset, int numBytes) {
278 for (int i = 0; i < numBytes; i++) {
279 int theByte = 0;
280 for (int j = 0; j < 8; j++) {
281 if (get(bitOffset)) {
282 theByte |= 1 << (7 - j);
283 }
284 bitOffset++;
285 }
286 array[offset + i] = (byte) theByte;
287 }
288 }
289
290 /**
291 * @return underlying array of ints. The first element holds the first 32 bits, and the least

Callers 2

interleaveWithECBytesMethod · 0.80

Calls 1

getMethod · 0.95

Tested by 1