import java.util.Arrays;
public class javaTest {
public static void main(String[] args) {
byte[] old = new byte[] {64,87,51,00,07,87};
byte[] n = null;
n = Arrays.copyOfRange(old, 1, 5);
for(byte i:n)
System.out.print(i+" ");
}
}
結(jié)果:

image.png
Arrays.copyOfRange(數(shù)組,開(kāi)始下標(biāo),結(jié)束下標(biāo));