Here you can find the source of subarray(byte[] src, int beginIndex)
public static byte[] subarray(byte[] src, int beginIndex)
//package com.java2s; /*/*from w ww. ja v a 2 s. com*/ * Copyright (c) 2000 - 2005 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ public class Main { public static byte[] subarray(byte[] src, int beginIndex) { if (beginIndex == 0) { return src; } byte[] res = new byte[src.length - beginIndex]; System.arraycopy(src, beginIndex, res, 0, res.length); return res; } public static byte[] subarray(byte[] src, int beginIndex, int endIndex) { if (beginIndex == 0 && endIndex == src.length) { return src; } if (endIndex > src.length) { endIndex = src.length; } byte[] res = new byte[endIndex - beginIndex]; System.arraycopy(src, beginIndex, res, 0, res.length); return res; } }