Code example for BigInteger

Methods: subtract

0
     * @param bi point in question 
     * @return true if the point contains within the range else false. 
     */ 
    public boolean contains(BigInteger bi)
    { 
        if ( left_.subtract(right_).signum() > 0 )
        { 
            /*  
             * left is greater than right we are wrapping around. 
             * So if the interval is [a,b) where a > b then we have 
             * 3 cases one of which holds for any given token k. 
             * (1) k > a -- return true 
             * (2) k < b -- return true 
             * (3) b < k < a -- return false 
            */ 
            if ( bi.subtract(left_).signum() >= 0 )
                return true; 
            else if (right_.subtract(bi).signum() > 0 )
                return true; 
            else 
                return false; 
        } 
        else if ( left_.subtract(right_).signum() < 0 )
        { 
            /* 
             * This is the range [a, b) where a < b.  
            */ 
            return ( bi.subtract(left_).signum() >= 0 && right_.subtract(bi).signum() >=0 );