copyTo method

void copyTo(
  1. int srcPos,
  2. ByteArray dest,
  3. int destPos,
  4. int length,
)

Copies a portion of this array to another array.

srcPos the starting position in this array dest the destination array destPos the starting position in the destination array length the number of bytes to copy

Implementation

void copyTo(int srcPos, ByteArray dest, int destPos, int length) {
  for (int i = 0; i < length; i++) {
    dest.set(destPos + i, get(srcPos + i));
  }
}