Here you can find the source of copy(byte[] source, byte[] target)
Parameter | Description |
---|---|
source | the source array |
target | the target array |
public static byte[] copy(byte[] source, byte[] target)
//package com.java2s; /*//from w ww. ja v a 2 s .co m * Copyright 2004-2008 H2 Group. Multiple-Licensed under the H2 License, Version 1.0, and under the Eclipse Public License, Version 1.0 (http://h2database.com/html/license.html). Initial Developer: H2 Group */ public class Main { /** * Copy the contents of the source array to the target array. If the size if the target array is too small, a larger array is created. * * @param source * the source array * @param target * the target array * @return the target array or a new one if the target array was too small */ public static byte[] copy(byte[] source, byte[] target) { int len = source.length; if (len > target.length) { target = new byte[len]; } System.arraycopy(source, 0, target, 0, len); return target; } }