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

6
LINES

< > BotCompany Repo | #1031654 // intToBytes_inArray_littleEndian_partial

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (31L/1K).

1  
svoid intToBytes_inArray_littleEndian_partial(int i, byte[] array, int idx) {
2  
  if (idx < array.length) array[idx] = (byte) i;
3  
  if (idx+1 < array.length) array[idx+1] = (byte) (i >>> 8);
4  
  if (idx+2 < array.length) array[idx+2] = (byte) (i >>> 16);
5  
  if (idx+3 < array.length) array[idx+3] = (byte) (i >>> 24);
6  
}

Author comment

Began life as a copy of #1029377

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031654
Snippet name: intToBytes_inArray_littleEndian_partial
Eternal ID of this version: #1031654/1
Text MD5: 171d5d6dc0ac7dcdfb27efe9f7fb39e8
Transpilation MD5: 187d0a0cbe95745b9dfae071d2f7fd0c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-25 04:09:26
Source code size: 318 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 159 / 242
Referenced in: [show references]