Here you can find the source of substr(byte[] i_Value, int i_BeginIndex)
public static byte[] substr(byte[] i_Value, int i_BeginIndex)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] substr(byte[] i_Value, int i_BeginIndex) { return substr(i_Value, i_BeginIndex, i_Value.length - i_BeginIndex); }//w w w.j a v a 2 s.c o m public static byte[] substr(byte[] i_Value, int i_BeginIndex, int i_SubLen) { int v_BeginIndex = i_BeginIndex % i_Value.length; int v_EndIndex = v_BeginIndex + i_SubLen; int v_NewArrLen = v_EndIndex <= i_Value.length ? i_SubLen : i_Value.length - v_BeginIndex - 1; v_EndIndex = v_BeginIndex + v_NewArrLen; byte[] v_Ret = new byte[v_NewArrLen]; for (int v_Index = v_BeginIndex; v_Index < v_EndIndex; v_Index++) { v_Ret[v_Index - v_BeginIndex] = i_Value[v_Index]; } return v_Ret; } }