Here you can find the source of copyOf(byte[] bytes, int startIndex, int length)
Parameter | Description |
---|---|
bytes | a parameter |
startIndex | a parameter |
length | a parameter |
public static byte[] copyOf(byte[] bytes, int startIndex, int length)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w .j a va2s . c o m*/ * Returns a new byte array of 'length' size containing the contents of the provided 'bytes' array beginning at startIndex to (startIndex+length-1) * * @param bytes * @param startIndex * @param length * @return */ public static byte[] copyOf(byte[] bytes, int startIndex, int length) { byte[] newByteArray = new byte[length]; for (int i = 0; i < length; i++) { newByteArray[i] = bytes[i + startIndex]; } return newByteArray; } }