public static byte getByte(String altValue, byte defaultVal) {
    if (altValue != null && altValue.length() > 0) {
      try {
        return Byte.parseByte(altValue);
      } catch (NumberFormatException e) {
        return (byte) altValue.charAt(0);
      }
    }
    return defaultVal;
  }
Return the byte value of the number string.

@param altValue
         The string containing a number.
@param defaultVal
         If the altValue does not represent a number, return the
         defaultVal.
serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java