Java Array Copy copyArrayRange(final byte[] value, int start, int end)

Here you can find the source of copyArrayRange(final byte[] value, int start, int end)

Description

Copy a sub range of the given array start is included, end is excluded

License

Open Source License

Parameter

Parameter Description
value The byte[] to be parsed
start The index of the first item to be copied
end The index after the last item to be copied

Return

The copied range

Declaration

static public byte[] copyArrayRange(final byte[] value, int start,
        int end) 

Method Source Code

//package com.java2s;
/**//from ww  w.  j a  va  2  s. com
 * ****************************************************************************
 * Copyright (c) 2015, MasterCard International Incorporated and/or its
 * affiliates. All rights reserved.
 * <p/>
 * The contents of this file may only be used subject to the MasterCard
 * Mobile Payment SDK for MCBP and/or MasterCard Mobile MPP UI SDK
 * Materials License.
 * <p/>
 * Please refer to the file LICENSE.TXT for full details.
 * <p/>
 * TO THE EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
 * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NON INFRINGEMENT. TO THE EXTENT PERMITTED BY LAW, IN NO EVENT SHALL
 * MASTERCARD OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 * *****************************************************************************
 */

public class Main {
    /**
     * Copy a sub range of the given array start is included, end is excluded
     * @param value The byte[] to be parsed
     * @param start The index of the first item to be copied
     * @param end The index after the last item to be copied
     * @return The copied range
     */
    static public byte[] copyArrayRange(final byte[] value, int start,
            int end) {
        int noBytes = end - start;
        byte[] result = new byte[noBytes];
        System.arraycopy(value, start, result, 0, noBytes);
        return result;
    }
}

Related

  1. copyArray2(Object v, int len)
  2. copyArrayAddFirst(String[] arr, String add)
  3. copyArrayCutFirst(String[] arr)
  4. copyArrayExceptLast(String[] array)
  5. copyArrayMax(int[] local, int[] merged)
  6. copyArrays(byte[] dest, byte[] source, int fromIdx)
  7. copyArrays(byte[] src, int srcOffset, byte[] dst, int dstOffset, int numBytes)
  8. copyArrayToStr(String[] src, String del)
  9. copyArrayWhenNotNull(byte[] source)