Byte array with padding of null bytes at the end: how to efficiently copy to smaller byte array

前端 未结 4 459
独厮守ぢ
独厮守ぢ 2020-12-28 16:17

Have:

[46][111][36][11][101][55][87][30][122][75][66][32][49][55][67][77][88][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]

4条回答
  •  醉梦人生
    2020-12-28 16:28

    why not try the static method array copy in the system class just give the source array src start position , destination array , destination start position and the length

            System.arraycopy(src, srcPos, dest, destPos, length);
            byte [] dest= new byte [6000];
            System.arraycopy(src, 0, dest, 0, 6000);
    

提交回复
热议问题