public long getLongSurroundedByWhitespace() {
        long num = 0L;
        boolean makeNegative = false;
        boolean readNonWhitespace = false;
        try {
            while (true) {
                int curr = reader.read();
                if (curr < 0)
                    break;
                if (Character.isWhitespace((char) curr)) {
                    if (readNonWhitespace)
                        break;
                } else if (curr == '-') {
                    makeNegative = true;
                    readNonWhitespace = true;
                } else if (curr >= '0' && curr <= '9') {
                    num *= 10L;
                    num += ((long) (curr - '0'));
                    readNonWhitespace = true;
                }
            }
        }
        catch (IOException e) {
           logger.log(Level.FINE, "Error detecting long.", e);
        }
        if (makeNegative)
            num = num * -1L;
        return num;
    }