public static long lowerHexToUnsignedLong(String lowerHex){
  int length=lowerHex.length();
  if (length < 1 || length > 32)   throw isntLowerHexLong(lowerHex);
  int i=length > 16 ? length - 16 : 0;
  long result=0;
  for (; i < length; i++) {
    char c=lowerHex.charAt(i);
    result<<=4;
    if (c >= '0' && c <= '9') {
      result|=c - '0';
    }
 else     if (c >= 'a' && c <= 'f') {
      result|=c - 'a' + 10;
    }
 else {
      throw isntLowerHexLong(lowerHex);
    }
  }
  return result;
}

public static long lowerHexToUnsignedLong ( String lowerHex ) { int length = lowerHex . length ( ) ; if ( length < 1 || length > 32 ) throw isntLowerHexLong ( lowerHex ) ; int i = length > 16 ? length - 16 : 0 ; long result = 0 ; for ( ; i < length ; i ++ ) { char c = lowerHex . charAt ( i ) ; result <<= 4 ; if ( c >= '0' && c <= '9' ) { result |= c - '0' ; } else if ( c >= 'a' && c <= 'f' ) { result |= c - 'a' + 10 ; } else { throw isntLowerHexLong ( lowerHex ) ; } } return result ; }
parses a 1 to 32 character lower - hex string with no prefix into an unsigned long , tossing any bits higher than 64 .
