Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1019649 // byteArrayFromShorts_littleEndian

JavaX fragment (include)

static byte[] byteArrayFromShorts_littleEndian(short[] a) {
  ret byteArrayFromShorts_littleEndian(a, 0, l(a));
}

static byte[] byteArrayFromShorts_littleEndian(short[] a, int from, int to) {
  byte[] b = new byte[(to-from)*2];
  for (int i = 0; i < a.length; i++) {
    short s = a[from+i];
    b[i*2] = (byte) s;
    b[i*2+1] = (byte) (s >> 8);
  }
  ret b;
}

Author comment

Began life as a copy of #1007030

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019649
Snippet name: byteArrayFromShorts_littleEndian
Eternal ID of this version: #1019649/4
Text MD5: 15da753724cfe6d483c937f2c7f2b5c4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-16 03:21:20
Source code size: 374 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 357 / 414
Version history: 3 change(s)
Referenced in: [show references]