static int[] hexToInts(S s) { if (odd(l(s))) fail("Hex string has odd length: " + quote(shorten(10, s))); int n = l(s) / 8; int[] ints = new[n]; for i to n: { int value = 0; for j to 4: { int idx = i*8+j*2; int a = parseHexChar(s.charAt(idx)); int b = parseHexChar(s.charAt(idx+1)); if (a < 0 || b < 0) fail("Bad hex byte: " + quote(substring(s, idx, idx+2)) + " at " + idx + "/" + l(s)); value |= ((a << 4) | b) << (j*8); } ints[i] = value; } ret ints; }