public static long toLongValue(String str) throws PageException {
  BigInteger bi=null;
  try {
    bi=new BigInteger(str);
  }
 catch (  Throwable 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);
}

public static long toLongValue ( String str ) throws PageException { BigInteger bi = null ; try { bi = new BigInteger ( str ) ; } catch ( Throwable 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 ) ; }
cast a object to a long value ( primitive value type )
