美文网首页
第 49 条:检查参数的有效性

第 49 条:检查参数的有效性

作者: 综合楼 | 来源:发表于2021-05-25 21:31 被阅读0次
    检查参数的有效性.jpeg
    /**
    * Returns a BigInteger whose value is (this mod m). This method
    * differs from the remainder method in that it always returns a
    * non-negative BigInteger.
    *
    * @param m the modulus, which must be positive
    * @return this mod m
    * @throws ArithmeticException if m is less than or equal to 0
    */
    public BigInteger mod(BigInteger m) {
        if (m.signum() <= 0)
            throw new ArithmeticException("Modulus <= 0: " + m);
        ... // Do the computation
    }
    
    // Inline use of Java's null-checking facility
    this.strategy = Objects.requireNonNull(strategy, "strategy");
    
    // Private helper function for a recursive sort
    private static void sort(long a[], int offset, int length) {
        assert a != null;
        assert offset >= 0 && offset <= a.length;
        assert length >= 0 && length <= a.length - offset;
        ... // Do the computation
    }
    

    相关文章

      网友评论

          本文标题:第 49 条:检查参数的有效性

          本文链接:https://www.haomeiwen.com/subject/bmxodltx.html