Android examples for File Input Output:Byte Array Copy
Copy byte array by range
//package com.book2s; public class Main { public static byte[] copyOfRange(byte[] original, int from, int to) { int newLength = to - from; if (newLength < 0) throw new IllegalArgumentException(from + " > " + to); byte[] copy = new byte[newLength]; System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength)); return copy; }/*from w w w . j a v a2 s. com*/ }