精品国产亚洲一区二区三区,男女作爱在线观看免费网站,欧美的又大又长做禁片A片,97国产精品人妻无码久久久

  • 相關(guān)軟件
    >BigInteger 創(chuàng)建者:webmaster 更新時間:2005-12-17 03:36


    不變的任意精度的整數(shù)。 在所有的操作中
    BigIntegers 看起來好象是用二進制補碼(類似 Java
    的基本整數(shù)類型)表示的 。BigIntegers 提供類似于所有 Java
    基本整數(shù)操作符和來自 java.lang.Math 的所有相關(guān)靜態(tài)方法。 此外,
    BigIntegers 還提供模算術(shù)操作, GCD 計算,基本測試,初期生成,位處理和一些其它的零碎操作。

    如同《Java 語言規(guī)范》中的定義,算術(shù)運算的語義極為類似于 java 的整數(shù)算術(shù)運算符。
    例如,被零除將拋出 ArithmeticException ,一個負(fù)數(shù)除以一個正數(shù)將產(chǎn)生一個負(fù)
    (或零)余數(shù)。
    《規(guī)范》中所有關(guān)于溢出的細(xì)節(jié)都忽略了,因為 BigIntegers
    能夠保存任意大數(shù)值的操作結(jié)果。

    移位操作的語義擴展了 Java 中的移位運算符而允許負(fù)的移位距離。
    移動負(fù)距離的右移的結(jié)果是一個左移,反之類似。無符號的右移運算符
    (>>>) 被忽略,因為該操作對該類提供的混合了“無限字長”的抽象沒有多大意義。

    位邏輯運算語義完全模擬
    Java 的位整數(shù)運算符。二目運算符 (與,或,異或)
    在執(zhí)行操作之前隱含地對兩個操作數(shù)中的較短者執(zhí)行符號擴展。

    比較操作執(zhí)行帶正負(fù)號的整數(shù)比較,類似于
    java 的關(guān)系比較和相等運算符所作的比較。

    提供模算術(shù)運算操作來計算余數(shù)、
    乘冪和多重逆。這些方法總是返回一個在 0 和 (模數(shù) - 1) 之間的,包括邊界在內(nèi)的)非負(fù)結(jié)果。

    位操作對它們操作數(shù)的二進制補碼的位進行操作。
    如果必要的話,操作數(shù)要做擴展以便它包含運算所需的位。
    沒有任何位操作能產(chǎn)生一個同所要操作的
    BigInteger 符號不同的數(shù),因為它們僅能影響單個位,并且該類提供的 “無限字長”抽象保證了在每個
    BigInteger 之前有無限多個 “虛擬符號位”。


    類 java.math.BigInteger



    java.lang.Object
      |
      +----java.lang.Number
          |
          +----java.math.BigInteger




    public class BigInteger
    extends Number




     
    參見:
     
    BigDecimal





    構(gòu)造子索引



    BigInteger(byte[])
    把一個包含著(帶正負(fù)號)整數(shù)的二進制補碼的字節(jié)數(shù)組翻譯為 BigInteger 。
    BigInteger(int, byte[])
    把一個整數(shù)的 sign-magnitude 表示法翻譯為 BigInteger 。
    BigInteger(int, int, Random)
    返回有指定 bitLength(可能是素數(shù))的隨機選擇的 BigInter 。
    BigInteger(int, Random)
    返回一個隨機數(shù),均勻分布在 [0, 2**numBits - 1] 之間
    (假設(shè)由 rndSrc 提供一個公平的隨機源) 。
    BigInteger(String)
      把一個字符串翻譯為一個 BigInteger ,該字符串包含可選的負(fù)號,后面跟著一個或多個十進制數(shù)字序列。
    BigInteger(String, int)
    把一個字符串翻譯為一個 BigInteger ,該字符串包含可選的負(fù)號,后面跟著一個或多個指定進制的數(shù)字序列。



    方法索引



    abs()
    返回一個 BigInteger ,它等于該數(shù)字的絕對值。
    add(BigInteger)
    返回一個 BigInteger ,其值是 (this + val) 。
    and(BigInteger)
    返回一個 BigInteger ,其值是 (this & val) 。
    andNot(BigInteger)
    返回一個 BigInteger ,其值是 (this & ~val) 。
    bitCount()
    返回該數(shù)的二進制補碼表示中不包括符號位在內(nèi)的位的個數(shù)。
    bitLength()
    返回該數(shù)的最小的二進制補碼表示法中位的個數(shù),
    即 *不包括* 一個符號位,例如(ceil(log2(this <0 ? -this : this + 1))).
    clearBit(int)
    返回一個 BigInteger ,它等于該數(shù)指定位清零后所得的值。
    compareTo(BigInteger)
    根據(jù)該數(shù)字是小于、等于還是大于 val 返回 -1、0 或 1。
    divide(BigInteger)
    返回一個 BigInteger ,其值是 (this / val) 。
    divideAndRemainder(BigInteger)
    返回一個包含兩個 BigInteger 的數(shù)組。
    doubleValue()
    把該數(shù)字轉(zhuǎn)換為一個 double 型。
    equals(Object)
    如果 x 是等于該數(shù)則返回 true 。
    flipBit(int)
    返回一個 BigInteger ,它等于該數(shù)指定位取反后所得的值。
    floatValue()
    把該數(shù)字轉(zhuǎn)換為一個 float 型。
    gcd(BigInteger)
    返回值為 abs(this) 和 abs(val) 最大公分母的 BigInteger 。
    getLowestSetBit()
    返回該數(shù)最右端 (lowest-order)是 1 的位的索引值,
    (即距最右 1 位之前的 0 位的個數(shù) )。
    hashCode()
    為該對象計算一個散列碼。
    intValue()
    把該數(shù)字轉(zhuǎn)換為一個 int 值。
    isProbablePrime(int)
    如果該 BigInteger 是素數(shù),則返回 true ;如果該 BigInteger 是合數(shù)則返回 false 。
    longValue()
    把該數(shù)字轉(zhuǎn)換為一個 long 型值。
    max(BigInteger)
    返回 BigInteger ,其值是 this 和 val 中的較大者。
    min(BigInteger)
    返回 BigInteger ,其值是 this 和 val 中的較小者。
    mod(BigInteger)
    返回一個 BigInteger ,其值是(this mod m )。
    modInverse(BigInteger)
    返回 this 取模 m 的模多重逆。
    modPow(BigInteger, BigInteger)
    返回一個 BigInteger ,其值是 (this ** exponent) mod m 。
    multiply(BigInteger)
    返回一個 BigInteger ,其值是 (this * val) 。
    negate()
    返回一個 BigInteger ,其值是 (-1 * this ) 。
    not()
    返回一個 BigInteger ,其值是 (~this) 。
    or(BigInteger)
    返回一個 BigInteger ,其值是 (this | val) 。
    pow(int)
    返回一個 BigInteger ,其值是 (this ** exponent) 。
    remainder(BigInteger)
    返回一個 BigInteger ,其值是 (this % val) 。
    setBit(int)
    返回一個 BigInteger ,其值等于該數(shù)被設(shè)置指定位后所得的值。
    shiftLeft(int)
    返回一個 BigInteger ,其值是 (this << n).
    shiftRight(int)
    返回一個 BigInteger ,其值是 (this >> n).
    signum()
    返回該數(shù)值的符號(即根據(jù)該數(shù)的值是正、零或負(fù)返回 -1 、0 或 1)。
    subtract(BigInteger)
    返回一個 BigInteger ,其值是 (this - val)。
    testBit(int)
    如果設(shè)置了指定位則返回 true 。
    toByteArray()
    返回該數(shù)值的二進制補碼表示。
    toString()
    以 10 為基數(shù)返回表示該數(shù)的字符串。
    toString(int)
    以指定數(shù)為基數(shù)返回表示該數(shù)的字符串。
    valueOf(long)
    返回一個是指定值的 BigInteger 。
    xor(BigInteger)
    返回一個 BigInteger ,其值是 (this ^ val) 。




    構(gòu)造子




    BigInteger

    public BigInteger(byte val[]) throws NumberFormatException


    把一個(帶符號)整數(shù)的二進制補碼表示的字節(jié)數(shù)組翻譯為
    BigInteger 。假定輸入數(shù)組是 big-endian 格式(即最有效字節(jié)在位置[0])
    (最有效字節(jié)的最有效位是符號位)。數(shù)組必須至少包含一個字節(jié),否則將拋出 NumberFormatException 。




    BigInteger

    public BigInteger(int signum,
                byte magnitude[]) throws NumberFormatException


    把一個整數(shù)的 sign-magnitude 表示法翻譯為 BigInteger 。符號表示為一個整數(shù)數(shù)值 (-1 表示負(fù)數(shù)、0 表示零、1 表示正數(shù))。數(shù)量用
    big-endian
    結(jié)構(gòu)表示(即最有效字節(jié)在位置[0])。一個無效的符號數(shù)值或一個 0 符號數(shù)值伴隨一個非零數(shù)量將導(dǎo)致 NumberFormatException 。零長度大小的數(shù)組是允許的,并且將得到結(jié)果
    0 (不管給定的符號數(shù)值是什么) 。




    BigInteger

    public BigInteger(String val,
                int radix) throws NumberFormatException


    把一個字符串翻譯為 BigInteger ,該字符串包含可選的負(fù)號,后面跟著一個或多個指定進制的數(shù)字序列
    (字符到數(shù)字的映射是由 Character.digit 提供的)。一個外部字符 (包括空白符),或一個超出從
    Character.MIN_RADIX(2) 到 Character.MAX_RADIX(36) 范圍的基數(shù)(
    包括邊界),將導(dǎo)致 NumberFormatException 異常。




    BigInteger

    public BigInteger(String val) throws NumberFormatException


    把一個字符串翻譯為 BigInteger ,該字符串包含可選的負(fù)號,后面跟著一個或多個十進制數(shù)字序列。字符到數(shù)字的映射是由 Character.digit 提供的。任何外部字符 (包括空白符) 將導(dǎo)致 NumberFormatException 異常。




    BigInteger

    public BigInteger(int numBits,
                Random rndSrc) throws IllegalArgumentException


    返回一個隨機數(shù),均勻分布在 [0, 2**numBits - 1] 之間
    (假設(shè)由 rndSrc 提供一個公平的隨機源)。
    注意該構(gòu)造子總是返回一個非負(fù)的 BigInteger 。
    如果 numBits <0,則拋出 illegalargumentexception 。




    BigInteger

    public BigInteger(int bitLength,
                int certainty,
                Random rnd)


    返回一個指定 bitLength (可能是一個素數(shù))的隨機選擇的 BigInter 。參數(shù) certainty 是一個對調(diào)用者愿意忍受的不確定性的度量:該數(shù)是素數(shù)的概率將超過 1 - 1/2**certainty 。執(zhí)行時間正比于確定性參數(shù)的值。用給定的隨機數(shù)發(fā)生器選擇進行素數(shù)測試的候選數(shù)。如果 bitLength <2 ,則拋出 arithmeticexception。






    方法



    valueOf

    public static BigInteger valueOf(long val)


    返回一個是指定值的 BigInteger 。 給該工廠提供首選的
    (long) 構(gòu)造子是因為它允許對頻繁使用的 BigIntegers (如 0 和 1)的重用,這種操作不需要輸出常數(shù)。




    add

    public BigInteger add(BigInteger val) throws ArithmeticException


    返回一個 BigInteger ,其值是 (this + val) 。




    subtract

    public BigInteger subtract(BigInteger val)


    返回一個 BigInteger ,其值是 (this - val) 。




    multiply

    public BigInteger multiply(BigInteger val)


    返回一個 BigInteger ,其值是 (this * val) 。




    divide

    public BigInteger divide(BigInteger val) throws ArithmeticException


    返回一個 BigInteger ,其值是 (this / val) 。 如果 val == 0 ,則拋出 ArithmeticException 。




    remainder

    public BigInteger remainder(BigInteger val) throws ArithmeticException


    返回一個 BigInteger ,其值是 (this % val) 。 如果 val == 0,則拋出 ArithmeticException 。




    divideAndRemainder

    public BigInteger[] divideAndRemainder(BigInteger val) throws ArithmeticException


    返回一個包含兩個 BigIntegers 的數(shù)組。 返回值的第一個 ([0]) 元素是商
    (this / val), 第二個 ([1])
    元素是余數(shù) (this % val) 。如果 val == 0 ,則拋出 ArithmeticException 。




    pow

    public BigInteger pow(int exponent) throws ArithmeticException


    返回一個 BigInteger ,其值是 (this ** exponent) 。 如果
    exponent <0(因為該操作將產(chǎn)生一個非整型值),則拋出 arithmeticexception 。注意:指數(shù)是一個整型數(shù)而不是 biginteger 。




    gcd

    public BigInteger gcd(BigInteger val)


    返回值為 abs(this) 和 abs(val) 最大公分母的 BigInteger 。 如果 this == 0 && val == 0,則返回 0。




    abs

    public BigInteger abs()


    返回一個 BigInteger ,它是該數(shù)值的絕對值。




    negate

    public BigInteger negate()


    返回一個 BigInteger ,其值是 (-1 * this ) 。




    signum

    public int signum()


    返回該數(shù)值的符號數(shù) (根據(jù)該數(shù)的值是正、零或負(fù)返回 -1 、
    0 或 1 ) 。




    mod

    public BigInteger mod(BigInteger m)


    返回一個 BigInteger ,其值是 this mod m 。 如果 m <= 0,則拋出 arithmeticexception。




    modPow

    public BigInteger modPow(BigInteger exponent,
                    BigInteger m)


    返回一個 BigInteger ,其值是 (this ** exponent) mod m 。 如果
    exponent == 1, 返回值是 (this mod m) 。 如果 exponent <0 , 返回值是 (this ** -exponent)的模多重逆。如果 m <="0,則拋出" arithmeticexception 。




    modInverse

    public BigInteger modInverse(BigInteger m) throws ArithmeticException


    返回 this 取模 m 的模多重逆。 如果 m<= 0 或 this 沒有多重逆 mod m (比如 gcd(this, m) !="1),則拋出" arithmeticexception 。




    shiftLeft

    public BigInteger shiftLeft(int n)


    返回一個 BigInteger ,其值是 (this << n)。計算 floor(this * 2**n)。




    shiftRight

    public BigInteger shiftRight(int n)


    返回一個 BigInteger ,其值是 (this >> n)。 執(zhí)行符號擴展(計算
    floor(this / 2**n))。




    and

    public BigInteger and(BigInteger val)


    返回一個 BigInteger ,其值是 (this & val) 。
    (如果 this 和 val 二者都是負(fù)的,則該方法返回一個負(fù)數(shù)。)




    or

    public BigInteger or(BigInteger val)


    返回一個 BigInteger ,其值是 (this | val) 。
    (如果 this 和 val 二者之一是負(fù)的,則該方法返回一個負(fù)數(shù)。)




    xor

    public BigInteger xor(BigInteger val)


    返回一個 BigInteger ,其值是 (this ^ val) 。
    (如果 this 和 val 二者只有一個是負(fù)的,則該方法返回一個負(fù)數(shù)。)




    not

    public BigInteger not()


    返回一個 BigInteger ,其值是 (~this) 。
    (如果 this 是非負(fù)的,則該方法返回一個負(fù)數(shù)。)




    andNot

    public BigInteger andNot(BigInteger val)


    返回一個 BigInteger ,其值是 (this & ~val) 。 該方法等價于 and(val.not()),它是進行掩模操作的便捷方法。
    (如果 this 是負(fù)數(shù)并且 val 是正數(shù),則該方法返回一個負(fù)數(shù)。)




    testBit

    public boolean testBit(int n) throws ArithmeticException


    如果設(shè)置了指定位則返回 true 。 (計算
    ((this & (1 << n)) !="0))。如果 n < 0,則拋出 arithmeticexception。


    setBit

    public BigInteger setBit(int n) throws ArithmeticException


    返回一個 BigInteger ,其值等于該數(shù)被設(shè)置指定位后所得值(計算 (this | (1
    << n)))。 如果 n < 0 ,則拋出 arithmeticexception 。




    clearBit

    public BigInteger clearBit(int n) throws ArithmeticException


    返回一個 BigInteger ,其值等于該數(shù)指定位清零后所得值(計算 (this & ~(1
    << n)))。 如果 n < 0,則拋出 arithmeticexception 。




    flipBit

    public BigInteger flipBit(int n) throws ArithmeticException


    返回一個 BigInteger ,其值等于該數(shù)指定位取反后所得值(計算 (this ^ (1
    << n)))。 如果 n < 0,則拋出 arithmeticexception 。




    getLowestSetBit

    public int getLowestSetBit()


    返回該數(shù)最右端 (lowest-order)是 1 的位的索引
    (即就是距最右端 1 位間的 0 位的個數(shù) ) 。 如果該數(shù)沒有 1 位,則返回 -1
    (計算 (this==0? -1 : log2(this & -this)))。




    bitLength

    public int bitLength()


    返回該數(shù)的最小二進制補碼表示的位的個數(shù),
    即 *不包括* 符號位
    (ceil(log2(this <0 ? -this : this + 1)))。對正數(shù)來說,這等價于普通二進制表示的位的個數(shù)。




    bitCount

    public int bitCount()


    返回該數(shù)的二進制補碼表示中不包擴符號位在內(nèi)的位的個數(shù)。
    該方法在 BigIntegers 之上實現(xiàn)位向量風(fēng)格的集合時很有用。




    isProbablePrime

    public boolean isProbablePrime(int certainty)


    如果該 BigInteger 可能是素數(shù),則返回 true ;如果它很明確是一個合數(shù),則返回 false 。
    參數(shù) certainty 是對調(diào)用者愿意忍受的不確定性的度量:如果該數(shù)是素數(shù)的概率超過了 1 - 1/2**certainty方法,則該方法返回
    true 。執(zhí)行時間正比于參數(shù)確定性的值。




    compareTo

    public int compareTo(BigInteger val)


    根據(jù)該數(shù)值是小于、等于、或大于 val 返回 -1、0 或 1 。該方法在六個邏輯比較運算符
    (<, ="=,">, >=, !=, <= ) 的操作中作為首選方法。進行這些比較的建議方法是:(x.compareto(y) 0) ,其中 是六個比較符中的一個。




    equals

    public boolean equals(Object x)


    如果 x 是一個 BigInteger 并且等于該數(shù)則返回 true 。
    提供該方法的目的是使 BigIntegers 可以作為散列碼關(guān)鍵字使用。



     
    覆蓋:
     
    類 Object 中的 equals



    min

    public BigInteger min(BigInteger val)


    返回 BigInteger ,其值是 this 和 val 中的較小者。
    若值相同,則兩者都可能被返回。




    max

    public BigInteger max(BigInteger val)


    返回 BigInteger ,其值是 this 和 val 中的較大者。
    若值相同,則兩者都可能被返回。




    hashCode

    public int hashCode()


    為該對象計算一個散列碼。



     
    覆蓋:
     
    類 Object 中的 hashCode



    toString

    public String toString(int radix)


    返回表示該數(shù)的字符串,基數(shù)為給定基數(shù) 。
    如果基數(shù)超出了
    Character.MIN_RADIX(2) 到 Character.MAX_RADIX(36)(包括兩者在內(nèi))
    的范圍,它會缺省設(shè)定為 10 (類似于 Integer.toString 的情形)。使用由 Character.forDigit 提供的數(shù)字到字符的映射,并且如果適當(dāng)?shù)脑挘€可以前置一個負(fù)號。 該表示法同 (String, int) 構(gòu)造子兼容。




    toString

    public String toString()


    返回表示該數(shù)的字符串,基數(shù)為 10 。
    使用由 Character.forDigit 提供的數(shù)字到字符的映射,并且如果合適的話,還可以前置一個負(fù)號。
    該表示法同 (String) 構(gòu)造子兼容,并且允許用 Java 的 + 運算符做字符串連接操作。



     
    覆蓋:
     
    類 Object 中的
    toString  



    toByteArray

    public byte[] toByteArray()


    返回該數(shù)值的二進制補碼表示。 數(shù)組是 big-endian 格式(即最有效字節(jié)在位置 [0]) 。該數(shù)組包含了需要表示該數(shù)的最小的字節(jié)數(shù)
    (ceil((this.bitLength() + 1)/8)) 。該表示法同(byte[])構(gòu)造子兼容。




    intValue

    public int intValue()


    把該數(shù)轉(zhuǎn)換為 int 值。 標(biāo)準(zhǔn)的限制原語轉(zhuǎn)換同《Java 語言規(guī)范》所定義的一樣。



     
    覆蓋:
     
    類 Number 中的
    intValue



    longValue

    public long longValue()


    把該數(shù)轉(zhuǎn)換為 long 型。標(biāo)準(zhǔn)的限制原語轉(zhuǎn)換同《Java 語言規(guī)范》定義的一樣。



     
    覆蓋:
     
    類 Number 中的
    longValue



    floatValue

    public float floatValue()


    把該數(shù)轉(zhuǎn)換為 float 型。該操作類似于《Java 語言規(guī)范》中定義的
    double-to-float 限制原語轉(zhuǎn)換:如果數(shù)值太大以致不能表示為一個浮點數(shù)時,它將被轉(zhuǎn)換為合適的無窮大或負(fù)無窮大。



     
    覆蓋:
     

    Number 中的

    floatValue



    doubleValue

    public double doubleValue()


    把該數(shù)轉(zhuǎn)換為 double 型。 該操作類似于《Java 語言規(guī)范》中定義的
    double-to-float 的限制原語轉(zhuǎn)換:如果數(shù)值太大以致不能表示為一個雙精度數(shù),它將被轉(zhuǎn)換為適當(dāng)?shù)臒o窮大或負(fù)無窮大。



     
    覆蓋:
     

    Number 中的
    doubleValue

    相關(guān)文章
    本頁查看次數(shù):