long toCompactValue ( int sign ) { if ( intLen == 0 || sign == 0 ) return 0L ; int [ ] mag = getMagnitudeArray ( ) ; int len = mag . length ; int d = mag [ 0 ] ; // If this MutableBigInteger can not be fitted into long, we need to // make a BigInteger object for the resultant BigDecimal object. if ( len > 2 || ( d < 0 && len == 2 ) ) return INFLATED ; long v = ( len == 2 ) ? ( ( mag [ 1 ] & LONG_MASK ) | ( d & LONG_MASK ) << 32 ) : d & LONG_MASK ; return sign == - 1 ? - v : v ; }
This is for internal use in converting from a MutableBigInteger object into a long value given a specified sign . returns INFLATED if value is not fit into long