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

11
LINES

< > BotCompany Repo | #1024738 // concatByteArrays (allows null arrays)

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

Libraryless. Click here for Pure Java version (1654L/11K).

1  
static byte[] concatByteArrays(byte[]... arrays) {
2  
  int l = 0;
3  
  for (byte[] a : arrays) l += l(a);
4  
  byte[] x = new byte[l];
5  
  int i = 0;
6  
  for (byte[] a : arrays) if (a != null) {
7  
    System.arraycopy(a, 0, x, i, l(a));
8  
    i += l(a);
9  
  }
10  
  ret x;
11  
}

Author comment

Began life as a copy of #1003113

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024738
Snippet name: concatByteArrays (allows null arrays)
Eternal ID of this version: #1024738/2
Text MD5: 5c15966b7a91bf7b11c80aff1db8a042
Transpilation MD5: 1a4b2641be7800c915a230d183bcbab4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-24 15:41:21
Source code size: 264 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 131 / 189
Version history: 1 change(s)
Referenced in: [show references]