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

11
LINES

< > BotCompany Repo | #1026975 - cloneSubByteArray - always make a copy

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

Libraryless. Click here for Pure Java version (2151L/14K).

static byte[] cloneSubByteArray(byte[] b, int start) {
  ret cloneSubByteArray(b, start, l(b));
}
  
static byte[] cloneSubByteArray(byte[] b, int start, int end) {
  start = max(start, 0); end = min(end, l(b));
  if (start >= end) ret new byte[0];
  byte[] x = new byte[end-start];
  System.arraycopy(b, start, x, 0, end-start);
  ret x;
}

Author comment

Began life as a copy of #1014874

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1026975
Snippet name: cloneSubByteArray - always make a copy
Eternal ID of this version: #1026975/1
Text MD5: 77014c6ded1a9ae20b242db8c9241c17
Transpilation MD5: d54ff20f5ff98b31e2c20268ea7a6dc8
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-05 02:11:08
Source code size: 350 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 37 / 60
Referenced in: [show references]

Formerly at http://tinybrain.de/1026975 & http://1026975.tinybrain.de