Libraryless. Click here for Pure Java version (120L/1K).
1 | static byte[] byteArrayFromShorts_bigEndian(short[] a) { |
2 | ret byteArrayFromShorts_bigEndian(a, 0, l(a)); |
3 | } |
4 | |
5 | static byte[] byteArrayFromShorts_bigEndian(short[] a, int from, int to) { |
6 | byte[] b = new byte[(to-from)*2]; |
7 | for (int i = 0; i < a.length; i++) { |
8 | short s = a[from+i]; |
9 | b[i*2] = (byte) (s >> 8); |
10 | b[i*2+1] = (byte) s; |
11 | } |
12 | ret b; |
13 | } |
Began life as a copy of #1019649
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035892 |
Snippet name: | byteArrayFromShorts_bigEndian |
Eternal ID of this version: | #1035892/1 |
Text MD5: | d7197e75898ecfcf310ab00aeab1f188 |
Transpilation MD5: | 1c49c1640ae7e1f93ddef31539012fee |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-08 16:13:11 |
Source code size: | 365 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 144 / 192 |
Referenced in: | [show references] |