private static int ToInt32D2(byte[] chars, int offset) { byte ch1 = (byte)(chars[offset + 0] - '0'); byte ch2 = (byte)(chars[offset + 1] - '0'); if (ch1 > 9 || ch2 > 9) return -1; return 10 * ch1 + ch2; }