Here you can find the source of cloneByteArray(byte[] b)
Parameter | Description |
---|---|
b | the byte array (may not be null) |
public static byte[] cloneByteArray(byte[] b)
//package com.java2s; /*//w w w. j ava2s. c om * Copyright 2004-2009 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 { /** * Create a new byte array and copy all the data. If the size of the byte array is zero, the same array is returned. * * @param b * the byte array (may not be null) * @return a new byte array */ public static byte[] cloneByteArray(byte[] b) { if (b == null) { return null; } int len = b.length; if (len == 0) { return b; } byte[] copy = new byte[len]; System.arraycopy(b, 0, copy, 0, len); return copy; } }