Java Array Copy copy(byte[] bytes)

Here you can find the source of copy(byte[] bytes)

Description

This function creates a copy of a byte array.

License

Open Source License

Parameter

Parameter Description
bytes The byte array.

Return

A copy of the byte array.

Declaration

static public byte[] copy(byte[] bytes) 

Method Source Code

//package com.java2s;
/************************************************************************
 * Copyright (c) Crater Dog Technologies(TM).  All Rights Reserved.     *
 ************************************************************************
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.        *
 *                                                                      *
 * This code is free software; you can redistribute it and/or modify it *
 * under the terms of The MIT License (MIT), as published by the Open   *
 * Source Initiative. (See http://opensource.org/licenses/MIT)          *
 ************************************************************************/

import java.util.Arrays;

public class Main {
    /**/*from  www  .  j a v  a 2s  .c o m*/
     * This function creates a copy of a byte array.
     *
     * @param bytes The byte array.
     * @return A copy of the byte array.
     */
    static public byte[] copy(byte[] bytes) {
        byte[] result = Arrays.copyOf(bytes, bytes.length);
        return result;
    }
}

Related

  1. arrayCopyAndAddEntry(T[] base, T extra)
  2. arraycopyAndInsertInt(final int[] src, final int idx, final int value)
  3. arrayCopyToNull(T[] source, int sourceOffset, T[] destination, int destinationOffset)
  4. arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove)
  5. Arrays_copyOf(int[] pos, int length)
  6. copy(byte[] data, int from)
  7. copy(double[][] a)
  8. copy(final boolean[] array)
  9. copy(final byte[] bytes)