in folsom/src/main/java/com/spotify/folsom/client/ascii/AsciiMemcacheDecoder.java [279:294]
private long parseLong(byte firstChar, ByteBuffer token) throws IOException {
// firstChar must be guarantee to be a digit.
long res = firstChar - '0';
if (res < 0 || res > 9) {
throw fail();
}
while (token.hasRemaining()) {
final int digit = token.get() - '0';
if (digit < 0 || digit > 9) {
throw fail();
}
res *= 10;
res += digit;
}
return res;
}