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 a = parseHexChar(s.charAt(i*8+j*2)); int b = parseHexChar(s.charAt(i*8+j*2+1)); if (a < 0 || b < 0) fail("Bad hex byte: " + quote(substring(s, i*2, i*2+2)) + " at " + i*2 + "/" + l(s)); value |= ((a << 4) | b) << (j*8); } ints[i] = value; } ret ints; }