public static long parseLong(byte[] bytes, int start, int length, int radix, boolean trim) {
    if (bytes == null) {
      throw new NumberFormatException("String is null");
    }
    if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) {
      throw new NumberFormatException("Invalid radix: " + radix);
    }
    if (trim) {
      // Handle leading/trailing whitespace
      int leadingSpaces = HiveStringUtils.findLeadingSpaces(bytes, start, length);
      int trailingSpaces = HiveStringUtils.findTrailingSpaces(bytes, start, length);
      start = start + leadingSpaces;
      // min() needed in the case that entire string is whitespace
      length = length - Math.min(length, leadingSpaces + trailingSpaces);
    }
    if (length == 0) {
      throw new NumberFormatException("Empty string!");
    }
    int offset = start;
    boolean negative = bytes[start] == '-';
    if (negative || bytes[start] == '+') {
      offset++;
      if (length == 1) {
        throw new NumberFormatException(LazyUtils.convertToString(bytes, start,
            length));
      }
    }

    return parse(bytes, start, length, offset, radix, negative);
  }
Parses the string argument as if it was an long value and returns the
result. Throws NumberFormatException if the string does not represent an
long quantity. The second argument specifies the radix to use when parsing
the value.

@param bytes
@param start
@param length
         a UTF-8 encoded string representation of a long quantity.
@param radix
         the base to use for conversion.
@param trim
         whether to trim leading/trailing whitespace
@return the value represented by the argument
@exception NumberFormatException
             if the argument could not be parsed as an long quantity.
serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyLong.java