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

18
LINES

< > BotCompany Repo | #1024596 // subIntArray

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

Transpiled version (2634L) is out of date.

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

ifclass IntRange
static int[] subIntArray(int[] a, IntRange r) {
  ret r == null ? null : subIntArray(a, r.start, r.end);
}
endif

Author comment

Began life as a copy of #1014874

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1024596
Snippet name: subIntArray
Eternal ID of this version: #1024596/3
Text MD5: f44dcb6fbf74f75e2eac3f5954b11055
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-12 10:37:48
Source code size: 503 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 220 / 340
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1024603 - subFloatArray