Java Array Clone clone(byte[] input)

Here you can find the source of clone(byte[] input)

Description

Clone a byte array.

License

Open Source License

Parameter

Parameter Description
input the byte array to clone

Return

new byte array, or null if input is null

Declaration

public static byte[] clone(byte[] input) 

Method Source Code

//package com.java2s;
/*******************************************************************************
* Copyright (c) 2017 JCrypTool Team and Contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/

public class Main {
    /**/*  w w  w .j a  va 2  s  .c om*/
     * Clone a byte array.
     *
     * @param input the byte array to clone
     * @return new byte array, or null if input is null
     */
    public static byte[] clone(byte[] input) {
        if (input == null) {
            return null;
        }
        byte[] ret = new byte[input.length];
        System.arraycopy(input, 0, ret, 0, input.length);
        return ret;
    }
}

Related

  1. clone(boolean[] array)
  2. clone(boolean[] array)
  3. clone(boolean[] in)
  4. clone(byte[] orig)
  5. clone(byte[][] im)
  6. clone(double[] array)
  7. clone(double[] p)