public static byte[] copyOf(byte[] src, int length) {
        byte[] dest = new byte[length];
        System.arraycopy(src, 0, dest, 0, Math.min(src.length, length));
        return dest;
    }
byte array copy.

@param src    src.
@param length new length.
@return new byte array.
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CodecUtils.java