Path: blob/master/test/jdk/java/math/BigInteger/largeMemory/SymmetricRangeTests.java
41154 views
/*1* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 6910473 8021204 8021203 9005933 8074460 807867226* @summary Test range of BigInteger values (use -Dseed=X to set PRNG seed)27* @library /test/lib28* @requires (sun.arch.data.model == "64" & os.maxMemory >= 10g)29* @run main/timeout=180/othervm -Xmx8g -XX:+CompactStrings SymmetricRangeTests30* @author Dmitry Nadezhin31* @key randomness32*/33import java.io.ByteArrayInputStream;34import java.io.ByteArrayOutputStream;35import java.io.IOException;36import java.io.ObjectInputStream;37import java.io.ObjectOutputStream;38import java.util.Arrays;39import java.math.BigInteger;40import java.util.Random;41import jdk.test.lib.RandomFactory;4243public class SymmetricRangeTests {4445private static final BigInteger MAX_VALUE = makeMaxValue();46private static final BigInteger MIN_VALUE = MAX_VALUE.negate();4748private static BigInteger makeMaxValue() {49byte[] ba = new byte[1 << 28];50Arrays.fill(ba, (byte) 0xFF);51ba[0] = (byte) 0x7F;52return new BigInteger(ba);53}5455private static void check(String msg, BigInteger actual, BigInteger expected) {56if (!actual.equals(expected)) {57throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());58}59}6061private static void check(String msg, double actual, double expected) {62if (actual != expected) {63throw new RuntimeException(msg + "=" + actual);64}65}6667private static void check(String msg, float actual, float expected) {68if (actual != expected) {69throw new RuntimeException(msg + "=" + actual);70}71}7273private static void check(String msg, long actual, long expected) {74if (actual != expected) {75throw new RuntimeException(msg + "=" + actual);76}77}7879private static void check(String msg, int actual, int expected) {80if (actual != expected) {81throw new RuntimeException(msg + "=" + actual);82}83}8485private static void testOverflowInMakePositive() {86System.out.println("Testing overflow in BigInteger.makePositive");87byte[] ba = new byte[Integer.MAX_VALUE - 2];88ba[0] = (byte) 0x80;89try {90BigInteger actual = new BigInteger(ba);91throw new RuntimeException("new BigInteger(ba).bitLength()=" + actual.bitLength());92} catch (ArithmeticException e) {93// expected94}95}9697private static void testBug8021204() {98System.out.println("Testing Bug 8021204");99StringBuilder sb = new StringBuilder();100sb.append('1');101for (int i = 0; i < (1 << 30) - 1; i++) {102sb.append('0');103}104sb.append('1');105String s = sb.toString();106sb = null;107try {108BigInteger actual = new BigInteger(s, 16);109throw new RuntimeException("new BigInteger(\"1000...001\").bitLength()=" + actual.bitLength());110} catch (ArithmeticException e) {111// expected112}113}114115private static void testOverflowInBitSieve() {116System.out.println("Testing overflow in BitSieve.sieveSingle");117int bitLength = (5 << 27) - 1;118try {119Random random = RandomFactory.getRandom();120BigInteger actual = new BigInteger(bitLength, 0, random);121throw new RuntimeException("new BigInteger(bitLength, 0, null).bitLength()=" + actual.bitLength());122} catch (ArithmeticException e) {123// expected124}125try {126BigInteger bi = BigInteger.ONE.shiftLeft(bitLength - 1).subtract(BigInteger.ONE);127BigInteger actual = bi.nextProbablePrime();128throw new RuntimeException("bi.nextActualPrime().bitLength()=" + actual.bitLength());129} catch (ArithmeticException e) {130// expected131}132}133134private static void testAdd() {135System.out.println("Testing BigInteger.add");136try {137BigInteger actual = MAX_VALUE.add(BigInteger.ONE);138throw new RuntimeException("BigInteger.MAX_VALUE.add(BigInteger.ONE).bitLength()=" + actual.bitLength());139} catch (ArithmeticException e) {140// expected141}142}143144private static void testSubtract() {145System.out.println("Testing BigInteger.subtract");146try {147BigInteger actual = MIN_VALUE.subtract(BigInteger.ONE);148throw new RuntimeException("BigInteger.MIN_VALUE.subtract(BigInteger.ONE).bitLength()=" + actual.bitLength());149} catch (ArithmeticException e) {150// expected151}152}153154private static void testMultiply() {155System.out.println("Testing BigInteger.multiply");156int py = 2000;157int px = Integer.MAX_VALUE - py;158BigInteger x = BigInteger.ONE.shiftLeft(px);159BigInteger y = BigInteger.ONE.shiftLeft(py);160try {161BigInteger actual = x.multiply(y);162throw new RuntimeException("(1 << " + px + " ) * (1 << " + py + ").bitLength()=" + actual.bitLength());163} catch (ArithmeticException e) {164// expected165}166}167168private static void testDivide() {169System.out.println("Testing BigInteger.divide");170check("BigInteger.MIN_VALUE.divide(BigInteger.valueOf(-1))",171MIN_VALUE.divide(BigInteger.valueOf(-1)), MAX_VALUE);172check("BigInteger.MIN_VALUE.divide(BigInteger.ONE)",173MIN_VALUE.divide(BigInteger.ONE), MIN_VALUE);174}175176private static void testDivideAndRemainder(String msg, BigInteger dividend, BigInteger divisor,177BigInteger expectedQuotent, BigInteger expectedRemainder) {178BigInteger[] qr = dividend.divideAndRemainder(divisor);179check(msg + "[0]", qr[0], expectedQuotent);180check(msg + "[1]", qr[1], expectedRemainder);181}182183private static void testDivideAndRemainder() {184System.out.println("Testing BigInteger.divideAndRemainder");185testDivideAndRemainder("BigInteger.MIN_VALUE.divideAndRemainder(BigInteger.valueOf(-1))",186MIN_VALUE, BigInteger.valueOf(-1),187MAX_VALUE,188BigInteger.ZERO);189}190191private static void testBug9005933() {192System.out.println("Testing Bug 9005933");193int dividendPow = 2147483646;194int divisorPow = 1568;195BigInteger dividend = BigInteger.ONE.shiftLeft(dividendPow);196BigInteger divisor = BigInteger.ONE.shiftLeft(divisorPow);197testDivideAndRemainder("(1 << " + dividendPow + ").divideAndRemainder(1 << " + divisorPow + ")",198dividend, divisor,199BigInteger.ONE.shiftLeft(dividendPow - divisorPow),200BigInteger.ZERO);201}202203private static void testRemainder() {204System.out.println("Testing BigInteger.remainder");205check("BigInteger.MIN_VALUE.remainder(BigInteger.valueOf(-1))",206MIN_VALUE.remainder(BigInteger.valueOf(-1)), BigInteger.ZERO);207}208209private static void testPow() {210System.out.println("Testing BigInteger.pow");211check("BigInteger.MIN_VALUE.pow(1)",212MIN_VALUE.pow(1), MIN_VALUE);213try {214BigInteger actual = BigInteger.valueOf(4).pow(Integer.MAX_VALUE);215throw new RuntimeException("BigInteger.valueOf(4).pow(Integer.MAX_VALUE).bitLength()=" + actual.bitLength());216} catch (ArithmeticException e) {217// expected218}219}220221private static void testGcd() {222System.out.println("Testing BigInteger.gcd");223check("BigInteger.MIN_VALUE.gcd(BigInteger.MIN_VALUE)",224MIN_VALUE.gcd(MIN_VALUE), MAX_VALUE);225check("BigInteger.MIN_VALUE.gcd(BigInteger.ZERO)",226MIN_VALUE.gcd(BigInteger.ZERO), MAX_VALUE);227check("BigInteger.ZERO.gcd(MIN_VALUE)",228BigInteger.ZERO.gcd(MIN_VALUE), MAX_VALUE);229}230231private static void testAbs() {232System.out.println("Testing BigInteger.abs");233check("BigInteger.MIN_VALUE.abs()",234MIN_VALUE.abs(), MAX_VALUE);235check("BigInteger.MAX_VALUE.abs()",236MAX_VALUE.abs(), MAX_VALUE);237}238239private static void testNegate() {240System.out.println("Testing BigInteger.negate");241check("BigInteger.MIN_VALUE.negate()",242MIN_VALUE.negate(), MAX_VALUE);243check("BigInteger.MAX_VALUE.negate()",244MAX_VALUE.negate(), MIN_VALUE);245}246247private static void testMod() {248System.out.println("Testing BigInteger.mod");249check("BigInteger.MIN_VALUE.mod(BigInteger.MAX_VALUE)",250MIN_VALUE.mod(MAX_VALUE), BigInteger.ZERO);251check("BigInteger.MAX_VALUE.mod(BigInteger.MAX_VALUE)",252MIN_VALUE.mod(MAX_VALUE), BigInteger.ZERO);253}254255private static void testModPow() {256System.out.println("Testing BigInteger.modPow");257BigInteger x = BigInteger.valueOf(3);258BigInteger m = BigInteger.valueOf(-4).subtract(MIN_VALUE);259check("BigInteger.valueOf(3).modPow(BigInteger.ONE, m)",260x.modPow(BigInteger.ONE, m), x);261}262263// slow test264private static void testModInverse() {265System.out.println("Testing BigInteger.modInverse");266check("BigInteger.MIN_VALUE.modInverse(BigInteger.MAX_VALUE)",267MIN_VALUE.modInverse(MAX_VALUE), MAX_VALUE.subtract(BigInteger.ONE));268}269270private static void testShiftLeft() {271System.out.println("Testing BigInteger.shiftLeft");272try {273BigInteger actual = MIN_VALUE.shiftLeft(1);274throw new RuntimeException("BigInteger.MIN_VALUE.shiftLeft(1).bitLength()=" + actual.bitLength());275} catch (ArithmeticException e) {276// expected277}278try {279BigInteger actual = MAX_VALUE.shiftLeft(1);280throw new RuntimeException("BigInteger.MAX_VALUE.shiftLeft(1).bitLength()=" + actual.bitLength());281} catch (ArithmeticException e) {282// expected283}284}285286private static void testShiftRight() {287System.out.println("Testing BigInteger.shiftRight");288try {289BigInteger actual = MIN_VALUE.shiftRight(-1);290throw new RuntimeException("BigInteger.MIN_VALUE.shiftRight(-1).bitLength()=" + actual.bitLength());291} catch (ArithmeticException e) {292// expected293}294try {295BigInteger actual = MAX_VALUE.shiftRight(-1);296throw new RuntimeException("BigInteger.MAX_VALUE.shiftRight(-1).bitLength()=" + actual.bitLength());297} catch (ArithmeticException e) {298// expected299}300}301302private static void testAnd() {303System.out.println("Testing BigInteger.and");304check("BigInteger.MIN_VALUE.and(BigInteger.MIN_VALUE)",305MIN_VALUE.and(MIN_VALUE), MIN_VALUE);306check("BigInteger.MAX_VALUE.and(BigInteger.MAX_VALUE)",307MAX_VALUE.and(MAX_VALUE), MAX_VALUE);308check("BigInteger.MIN_VALUE.and(BigInteger.MAX_VALUE)",309MIN_VALUE.and(MAX_VALUE), BigInteger.ONE);310try {311BigInteger actual = MIN_VALUE.and(BigInteger.valueOf(-2));312throw new RuntimeException("BigInteger.MIN_VALUE.and(-2)).bitLength()=" + actual.bitLength());313} catch (ArithmeticException e) {314// expected315}316}317318private static void testOr() {319System.out.println("Testing BigInteger.or");320check("BigInteger.MIN_VALUE.or(BigInteger.MIN_VALUE)",321MIN_VALUE.or(MIN_VALUE), MIN_VALUE);322check("BigInteger.MAX_VALUE.or(BigInteger.MAX_VALUE)",323MAX_VALUE.or(MAX_VALUE), MAX_VALUE);324check("BigInteger.MIN_VALUE.and(BigInteger.MAX_VALUE)",325MIN_VALUE.or(MAX_VALUE), BigInteger.valueOf(-1));326}327328private static void testXor() {329System.out.println("Testing BigInteger.xor");330check("BigInteger.MIN_VALUE.xor(BigInteger.MIN_VALUE)",331MIN_VALUE.xor(MIN_VALUE), BigInteger.ZERO);332check("BigInteger.MAX_VALUE.xor(BigInteger.MAX_VALUE)",333MAX_VALUE.xor(MAX_VALUE), BigInteger.ZERO);334check("BigInteger.MIN_VALUE.xor(BigInteger.MAX_VALUE)",335MIN_VALUE.xor(MAX_VALUE), BigInteger.valueOf(-2));336try {337BigInteger actual = MIN_VALUE.xor(BigInteger.ONE);338throw new RuntimeException("BigInteger.MIN_VALUE.xor(BigInteger.ONE)).bitLength()=" + actual.bitLength());339} catch (ArithmeticException e) {340// expected341}342}343344private static void testNot() {345System.out.println("Testing BigInteger.not");346check("BigInteger.MIN_VALUE.not()",347MIN_VALUE.not(), MAX_VALUE.subtract(BigInteger.ONE));348try {349BigInteger actual = MAX_VALUE.not();350throw new RuntimeException("BigInteger.MAX_VALUE.not()).bitLength()=" + actual.bitLength());351} catch (ArithmeticException e) {352// expected353}354}355356private static void testSetBit() {357System.out.println("Testing BigInteger.setBit");358check("BigInteger.MIN_VALUE.setBit(" + Integer.MAX_VALUE + ")",359MIN_VALUE.setBit(Integer.MAX_VALUE), MIN_VALUE);360try {361BigInteger actual = MAX_VALUE.setBit(Integer.MAX_VALUE);362throw new RuntimeException("BigInteger.MAX_VALUE.setBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());363} catch (ArithmeticException e) {364// expected365}366}367368private static void testClearBit() {369System.out.println("Testing BigInteger.clearBit");370check("BigInteger.MAX_VALUE.clearBit(" + Integer.MAX_VALUE + ")",371MAX_VALUE.clearBit(Integer.MAX_VALUE), MAX_VALUE);372try {373BigInteger actual = MIN_VALUE.clearBit(Integer.MAX_VALUE);374throw new RuntimeException("BigInteger.MIN_VALUE.clearBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());375} catch (ArithmeticException e) {376// expected377}378try {379BigInteger actual = MIN_VALUE.clearBit(0);380throw new RuntimeException("BigInteger.MIN_VALUE.clearBit(0).bitLength()=" + actual.bitLength());381} catch (ArithmeticException e) {382// expected383}384}385386private static void testFlipBit() {387System.out.println("Testing BigInteger.flipBit");388try {389BigInteger actual = MIN_VALUE.flipBit(Integer.MAX_VALUE);390throw new RuntimeException("BigInteger.MIN_VALUE.flipBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());391} catch (ArithmeticException e) {392// expected393}394try {395BigInteger actual = MIN_VALUE.flipBit(0);396throw new RuntimeException("BigInteger.MIN_VALUE.flipBit(0).bitLength()=" + actual.bitLength());397} catch (ArithmeticException e) {398// expected399}400try {401BigInteger actual = MAX_VALUE.flipBit(Integer.MAX_VALUE);402throw new RuntimeException("BigInteger.MAX_VALUE.flipBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());403} catch (ArithmeticException e) {404// expected405}406}407408private static void testGetLowestSetBit() {409System.out.println("Testing BigInteger.getLowestSetBit");410check("BigInteger.MIN_VALUE.getLowestSetBit()",411MIN_VALUE.getLowestSetBit(), 0);412check("BigInteger.MAX_VALUE.getLowestSetBit()",413MAX_VALUE.getLowestSetBit(), 0);414}415416private static void testBitLength() {417System.out.println("Testing BigInteger.bitLength");418check("BigInteger.MIN_NEXT.bitLength()",419MIN_VALUE.bitLength(), Integer.MAX_VALUE);420check("BigInteger.MAX_VALUE.bitLength()",421MAX_VALUE.bitLength(), Integer.MAX_VALUE);422}423424private static void testBitCount() {425System.out.println("Testing BigInteger.bitCount");426check("BigInteger.MIN_VALUE.bitCount()",427MIN_VALUE.bitCount(), Integer.MAX_VALUE - 1);428check("BigInteger.MAX_VALUE.bitCount()",429MAX_VALUE.bitCount(), Integer.MAX_VALUE);430}431432private static void testToString(String msg, int radix, BigInteger bi, int length, String startsWith, char c) {433String s = bi.toString(radix);434if (s.length() != length) {435throw new RuntimeException(msg + ".length=" + s.length());436}437if (!s.startsWith(startsWith)) {438throw new RuntimeException(msg + "[0]=" + s.substring(0, startsWith.length()));439}440for (int i = startsWith.length(); i < s.length(); i++) {441if (s.charAt(i) != c) {442throw new RuntimeException(msg + "[" + i + "]='" + s.charAt(i) + "'");443}444}445}446447private static void testToString() {448System.out.println("Testing BigInteger.toString");449testToString("BigInteger.MIN_VALUE.toString(16)=", 16,450BigInteger.valueOf(-1).shiftLeft(Integer.MAX_VALUE - 1),451(1 << 29) + 1, "-4", '0');452}453454private static void testToByteArrayWithConstructor(String msg, BigInteger bi, int length, byte msb, byte b, byte lsb) {455byte[] ba = bi.toByteArray();456if (ba.length != length) {457throw new RuntimeException(msg + ".length=" + ba.length);458}459if (ba[0] != msb) {460throw new RuntimeException(msg + "[0]=" + ba[0]);461}462for (int i = 1; i < ba.length - 1; i++) {463if (ba[i] != b) {464throw new RuntimeException(msg + "[" + i + "]=" + ba[i]);465}466}467if (ba[ba.length - 1] != lsb) {468throw new RuntimeException(msg + "[" + (ba.length - 1) + "]=" + ba[ba.length - 1]);469}470BigInteger actual = new BigInteger(ba);471if (!actual.equals(bi)) {472throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());473}474}475476private static void testToByteArrayWithConstructor() {477System.out.println("Testing BigInteger.toByteArray with constructor");478testToByteArrayWithConstructor("BigInteger.MIN_VALUE.toByteArray()",479MIN_VALUE, (1 << 28), (byte) 0x80, (byte) 0x00, (byte) 0x01);480testToByteArrayWithConstructor("BigInteger.MAX_VALUE.toByteArray()",481MAX_VALUE, (1 << 28), (byte) 0x7f, (byte) 0xff, (byte) 0xff);482483byte[] ba = new byte[1 << 28];484ba[0] = (byte) 0x80;485try {486BigInteger actual = new BigInteger(-1, ba);487throw new RuntimeException("new BigInteger(-1, ba).bitLength()=" + actual.bitLength());488} catch (ArithmeticException e) {489// expected490}491try {492BigInteger actual = new BigInteger(1, ba);493throw new RuntimeException("new BigInteger(1, ba).bitLength()=" + actual.bitLength());494} catch (ArithmeticException e) {495// expected496}497}498499private static void testIntValue() {500System.out.println("Testing BigInteger.intValue");501check("BigInteger.MIN_VALUE.intValue()",502MIN_VALUE.intValue(), 1);503check("BigInteger.MAX_VALUE.floatValue()",504MAX_VALUE.intValue(), -1);505}506507private static void testLongValue() {508System.out.println("Testing BigInteger.longValue");509check("BigInteger.MIN_VALUE.longValue()",510MIN_VALUE.longValue(), 1L);511check("BigInteger.MAX_VALUE.longValue()",512MAX_VALUE.longValue(), -1L);513}514515private static void testFloatValue() {516System.out.println("Testing BigInteger.floatValue, Bug 8021203");517check("BigInteger.MIN_VALUE_.floatValue()",518MIN_VALUE.floatValue(), Float.NEGATIVE_INFINITY);519check("BigInteger.MAX_VALUE.floatValue()",520MAX_VALUE.floatValue(), Float.POSITIVE_INFINITY);521}522523private static void testDoubleValue() {524System.out.println("Testing BigInteger.doubleValue, Bug 8021203");525check("BigInteger.MIN_VALUE.doubleValue()",526MIN_VALUE.doubleValue(), Double.NEGATIVE_INFINITY);527check("BigInteger.MAX_VALUE.doubleValue()",528MAX_VALUE.doubleValue(), Double.POSITIVE_INFINITY);529}530531private static void testSerialization(String msg, BigInteger bi) {532try {533ByteArrayOutputStream baOut = new ByteArrayOutputStream((1 << 28) + 1000);534ObjectOutputStream out = new ObjectOutputStream(baOut);535out.writeObject(bi);536out.close();537out = null;538byte[] ba = baOut.toByteArray();539baOut = null;540ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(ba));541BigInteger actual = (BigInteger) in.readObject();542if (!actual.equals(bi)) {543throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());544}545} catch (IOException | ClassNotFoundException e) {546throw new RuntimeException(msg + " raised exception ", e);547}548}549550private static void testSerialization() {551System.out.println("Testing BigInteger serialization");552testSerialization("BigInteger.MIN_VALUE.intValue()",553MIN_VALUE);554testSerialization("BigInteger.MAX_VALUE.floatValue()",555MAX_VALUE);556}557558private static void testLongValueExact() {559System.out.println("Testing BigInteger.longValueExact");560try {561long actual = MIN_VALUE.longValueExact();562throw new RuntimeException("BigInteger.MIN_VALUE.longValueExact()= " + actual);563} catch (ArithmeticException e) {564// excpected565}566try {567long actual = MAX_VALUE.longValueExact();568throw new RuntimeException("BigInteger.MAX_VALUE.longValueExact()= " + actual);569} catch (ArithmeticException e) {570// excpected571}572}573574private static void testIntValueExact() {575System.out.println("Testing BigInteger.intValueExact");576try {577long actual = MIN_VALUE.intValueExact();578throw new RuntimeException("BigInteger.MIN_VALUE.intValueExact()= " + actual);579} catch (ArithmeticException e) {580// excpected581}582try {583long actual = MAX_VALUE.intValueExact();584throw new RuntimeException("BigInteger.MAX_VALUE.intValueExact()= " + actual);585} catch (ArithmeticException e) {586// excpected587}588}589590private static void testShortValueExact() {591System.out.println("Testing BigInteger.shortValueExact");592try {593long actual = MIN_VALUE.shortValueExact();594throw new RuntimeException("BigInteger.MIN_VALUE.shortValueExact()= " + actual);595} catch (ArithmeticException e) {596// excpected597}598try {599long actual = MAX_VALUE.shortValueExact();600throw new RuntimeException("BigInteger.MAX_VALUE.shortValueExact()= " + actual);601} catch (ArithmeticException e) {602// excpected603}604}605606private static void testByteValueExact() {607System.out.println("Testing BigInteger.byteValueExact");608try {609long actual = MIN_VALUE.byteValueExact();610throw new RuntimeException("BigInteger.MIN_VALUE.byteValueExact()= " + actual);611} catch (ArithmeticException e) {612// excpected613}614try {615long actual = MAX_VALUE.byteValueExact();616throw new RuntimeException("BigInteger.MAX_VALUE.byteValueExact()= " + actual);617} catch (ArithmeticException e) {618// excpected619}620}621622public static void main(String... args) {623testOverflowInMakePositive();624testBug8021204();625testOverflowInBitSieve();626testAdd();627testSubtract();628testMultiply();629testDivide();630testDivideAndRemainder();631testBug9005933();632testRemainder();633testPow();634testGcd();635testAbs();636testNegate();637testMod();638testModPow();639// testModInverse();640testShiftLeft();641testShiftRight();642testAnd();643testOr();644testXor();645testNot();646testSetBit();647testClearBit();648testFlipBit();649testGetLowestSetBit();650testBitLength();651testBitCount();652testToString();653testToByteArrayWithConstructor();654testIntValue();655testLongValue();656testFloatValue();657testDoubleValue();658testSerialization();659testLongValueExact();660testIntValueExact();661testShortValueExact();662testByteValueExact();663}664}665666667