private static int ToInt32D7(byte[] chars, int offset, int count) { int value = 0; for (int i = 0; i < count; i++) { byte ch = (byte)(chars[offset + i] - '0'); if (ch > 9) return -1; value = value * 10 + ch; } return value; }