Here you can find the source of subByte(byte[] data, int start)
public static byte[] subByte(byte[] data, int start)
//package com.java2s; public class Main { /**//from www.j a va 2s .c o m * @param data * @param start * @param end * @return */ public static byte[] subByte(byte[] data, int start, int end) { int len = data.length; if (start >= len || end <= start || end < 1) { return null; } byte[] result = new byte[(end - start)]; for (int i = start, j = 0; i < len; i++, j++) { if (i < end) { result[j] = data[i]; } else { break; } } return result; } public static byte[] subByte(byte[] data, int start) { int len = data.length; if (start >= len) { return null; } if (start < 0) { start = len + start; if (start < 0) { return null; } } byte[] result = new byte[(len - start)]; for (int i = start, j = 0; i < len; i++, j++) { result[j] = data[i]; } return result; } }