code: public static long toLongValue(String str) throws PageException {
  	BigInteger bi = null;
  	try {
  	    bi = new BigInteger(str);
  
  	}
  	catch (Throwable t) {
  	    ExceptionUtil.rethrowIfNecessary(t);
  	}
  	if (bi != null) {
  	    if (bi.bitLength() < 64) return bi.longValue();
  	    throw new ApplicationException("number [" + str + "] cannot be casted to a long value, number is to long (" + (bi.bitLength() + 1) + " bit)");
  	}
  	return (long) toDoubleValue(str);
      }
docs: cast a Object to a long value (primitive value type)
  
  @param str Object to cast
  @return casted long value
  @throws PageException