static byte[] subByteArray(byte[] b, int start) { ret subByteArray(b, start, l(b)); } static byte[] subByteArray(byte[] 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 byte[0]; byte[] x = new byte[end-start]; System.arraycopy(b, start, x, 0, end-start); ret x; } ifclass IntRange static byte[] subByteArray(byte[] b, IntRange r) { ret r == null ?: subByteArray(b, r.start, r.end); } endif