在做項目時要用到byte[]的copy,通過for循環是可以實現的,但是再想能不能用別的方法實現,最好調用一個方法,免去for循環。終於讓我找到一個方法
byte[] parent = new byte[1024*8]; byte[] children = new byte[123]; System.arraycopy(parent,5,children,0,123);
四個參數分別表示:
第一個:原數組
第二個:原數組的開始位置
第三個:目標數組
第四個:目標數組的開始位置
第五個:需要copy的長度