Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/math/BigInteger/SymmetricRangeTests.java
38812 views
/*1* Copyright (c) 2013, 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* This test is intentionally ignored because of huge memory requirements25* @ test26* @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests27* @bug 6910473 8021204 8021203 900593328* @summary Test range of BigInteger values29* @author Dmitry Nadezhin30* @key randomness31*/32import java.io.ByteArrayInputStream;33import java.io.ByteArrayOutputStream;34import java.io.IOException;35import java.io.ObjectInputStream;36import java.io.ObjectOutputStream;37import java.util.Arrays;38import java.util.Random;39import java.math.BigInteger;4041public class SymmetricRangeTests {4243private static final BigInteger MAX_VALUE = makeMaxValue();44private static final BigInteger MIN_VALUE = MAX_VALUE.negate();4546private static BigInteger makeMaxValue() {47byte[] ba = new byte[1 << 28];48Arrays.fill(ba, (byte) 0xFF);49ba[0] = (byte) 0x7F;50return new BigInteger(ba);51}5253private static void check(String msg, BigInteger actual, BigInteger expected) {54if (!actual.equals(expected)) {55throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());56}57}5859private static void check(String msg, double actual, double expected) {60if (actual != expected) {61throw new RuntimeException(msg + "=" + actual);62}63}6465private static void check(String msg, float actual, float expected) {66if (actual != expected) {67throw new RuntimeException(msg + "=" + actual);68}69}7071private static void check(String msg, long actual, long expected) {72if (actual != expected) {73throw new RuntimeException(msg + "=" + actual);74}75}7677private static void check(String msg, int actual, int expected) {78if (actual != expected) {79throw new RuntimeException(msg + "=" + actual);80}81}8283private static void testOverflowInMakePositive() {84System.out.println("Testing overflow in BigInteger.makePositive");85byte[] ba = new byte[Integer.MAX_VALUE - 2];86ba[0] = (byte) 0x80;87try {88BigInteger actual = new BigInteger(ba);89throw new RuntimeException("new BigInteger(ba).bitLength()=" + actual.bitLength());90} catch (ArithmeticException e) {91// expected92}93}9495private static void testBug8021204() {96System.out.println("Testing Bug 8021204");97StringBuilder sb = new StringBuilder();98sb.append('1');99for (int i = 0; i < (1 << 30) - 1; i++) {100sb.append('0');101}102sb.append('1');103String s = sb.toString();104sb = null;105try {106BigInteger actual = new BigInteger(s, 16);107throw new RuntimeException("new BigInteger(\"1000...001\").bitLength()=" + actual.bitLength());108} catch (ArithmeticException e) {109// expected110}111}112113private static void testOverflowInBitSieve() {114System.out.println("Testing overflow in BitSieve.sieveSingle");115int bitLength = (5 << 27) - 1;116try {117Random rnd = new Random();118BigInteger actual = new BigInteger(bitLength, 0, rnd);119throw new RuntimeException("new BigInteger(bitLength, 0, null).bitLength()=" + actual.bitLength());120} catch (ArithmeticException e) {121// expected122}123try {124BigInteger bi = BigInteger.ONE.shiftLeft(bitLength - 1).subtract(BigInteger.ONE);125BigInteger actual = bi.nextProbablePrime();126throw new RuntimeException("bi.nextActualPrime().bitLength()=" + actual.bitLength());127} catch (ArithmeticException e) {128// expected129}130}131132private static void testAdd() {133System.out.println("Testing BigInteger.add");134try {135BigInteger actual = MAX_VALUE.add(BigInteger.ONE);136throw new RuntimeException("BigInteger.MAX_VALUE.add(BigInteger.ONE).bitLength()=" + actual.bitLength());137} catch (ArithmeticException e) {138// expected139}140}141142private static void testSubtract() {143System.out.println("Testing BigInteger.subtract");144try {145BigInteger actual = MIN_VALUE.subtract(BigInteger.ONE);146throw new RuntimeException("BigInteger.MIN_VALUE.subtract(BigInteger.ONE).bitLength()=" + actual.bitLength());147} catch (ArithmeticException e) {148// expected149}150}151152private static void testMultiply() {153System.out.println("Testing BigInteger.multiply");154int py = 2000;155int px = Integer.MAX_VALUE - py;156BigInteger x = BigInteger.ONE.shiftLeft(px);157BigInteger y = BigInteger.ONE.shiftLeft(py);158try {159BigInteger actual = x.multiply(y);160throw new RuntimeException("(1 << " + px + " ) * (1 << " + py + ").bitLength()=" + actual.bitLength());161} catch (ArithmeticException e) {162// expected163}164}165166private static void testDivide() {167System.out.println("Testing BigInteger.divide");168check("BigInteger.MIN_VALUE.divide(BigInteger.valueOf(-1))",169MIN_VALUE.divide(BigInteger.valueOf(-1)), MAX_VALUE);170check("BigInteger.MIN_VALUE.divide(BigInteger.ONE)",171MIN_VALUE.divide(BigInteger.ONE), MIN_VALUE);172}173174private static void testDivideAndRemainder(String msg, BigInteger dividend, BigInteger divisor,175BigInteger expectedQuotent, BigInteger expectedRemainder) {176BigInteger[] qr = dividend.divideAndRemainder(divisor);177check(msg + "[0]", qr[0], expectedQuotent);178check(msg + "[1]", qr[1], expectedRemainder);179}180181private static void testDivideAndRemainder() {182System.out.println("Testing BigInteger.divideAndRemainder");183testDivideAndRemainder("BigInteger.MIN_VALUE.divideAndRemainder(BigInteger.valueOf(-1))",184MIN_VALUE, BigInteger.valueOf(-1),185MAX_VALUE,186BigInteger.ZERO);187}188189private static void testBug9005933() {190System.out.println("Testing Bug 9005933");191int dividendPow = 2147483646;192int divisorPow = 1568;193BigInteger dividend = BigInteger.ONE.shiftLeft(dividendPow);194BigInteger divisor = BigInteger.ONE.shiftLeft(divisorPow);195testDivideAndRemainder("(1 << " + dividendPow + ").divideAndRemainder(1 << " + divisorPow + ")",196dividend, divisor,197BigInteger.ONE.shiftLeft(dividendPow - divisorPow),198BigInteger.ZERO);199}200201private static void testRemainder() {202System.out.println("Testing BigInteger.remainder");203check("BigInteger.MIN_VALUE.remainder(BigInteger.valueOf(-1))",204MIN_VALUE.remainder(BigInteger.valueOf(-1)), BigInteger.ZERO);205}206207private static void testPow() {208System.out.println("Testing BigInteger.pow");209check("BigInteger.MIN_VALUE.pow(1)",210MIN_VALUE.pow(1), MIN_VALUE);211try {212BigInteger actual = BigInteger.valueOf(4).pow(Integer.MAX_VALUE);213throw new RuntimeException("BigInteger.valueOf(4).pow(Integer.MAX_VALUE).bitLength()=" + actual.bitLength());214} catch (ArithmeticException e) {215// expected216}217}218219private static void testGcd() {220System.out.println("Testing BigInteger.gcd");221check("BigInteger.MIN_VALUE.gcd(BigInteger.MIN_VALUE)",222MIN_VALUE.gcd(MIN_VALUE), MAX_VALUE);223check("BigInteger.MIN_VALUE.gcd(BigInteger.ZERO)",224MIN_VALUE.gcd(BigInteger.ZERO), MAX_VALUE);225check("BigInteger.ZERO.gcd(MIN_VALUE)",226BigInteger.ZERO.gcd(MIN_VALUE), MAX_VALUE);227}228229private static void testAbs() {230System.out.println("Testing BigInteger.abs");231check("BigInteger.MIN_VALUE.abs()",232MIN_VALUE.abs(), MAX_VALUE);233check("BigInteger.MAX_VALUE.abs()",234MAX_VALUE.abs(), MAX_VALUE);235}236237private static void testNegate() {238System.out.println("Testing BigInteger.negate");239check("BigInteger.MIN_VALUE.negate()",240MIN_VALUE.negate(), MAX_VALUE);241check("BigInteger.MAX_VALUE.negate()",242MAX_VALUE.negate(), MIN_VALUE);243}244245private static void testMod() {246System.out.println("Testing BigInteger.mod");247check("BigInteger.MIN_VALUE.mod(BigInteger.MAX_VALUE)",248MIN_VALUE.mod(MAX_VALUE), BigInteger.ZERO);249check("BigInteger.MAX_VALUE.mod(BigInteger.MAX_VALUE)",250MIN_VALUE.mod(MAX_VALUE), BigInteger.ZERO);251}252253private static void testModPow() {254System.out.println("Testing BigInteger.modPow");255BigInteger x = BigInteger.valueOf(3);256BigInteger m = BigInteger.valueOf(-4).subtract(MIN_VALUE);257check("BigInteger.valueOf(3).modPow(BigInteger.ONE, m)",258x.modPow(BigInteger.ONE, m), x);259}260261// slow test262private static void testModInverse() {263System.out.println("Testing BigInteger.modInverse");264check("BigInteger.MIN_VALUE.modInverse(BigInteger.MAX_VALUE)",265MIN_VALUE.modInverse(MAX_VALUE), MAX_VALUE.subtract(BigInteger.ONE));266}267268private static void testShiftLeft() {269System.out.println("Testing BigInteger.shiftLeft");270try {271BigInteger actual = MIN_VALUE.shiftLeft(1);272throw new RuntimeException("BigInteger.MIN_VALUE.shiftLeft(1).bitLength()=" + actual.bitLength());273} catch (ArithmeticException e) {274// expected275}276try {277BigInteger actual = MAX_VALUE.shiftLeft(1);278throw new RuntimeException("BigInteger.MAX_VALUE.shiftLeft(1).bitLength()=" + actual.bitLength());279} catch (ArithmeticException e) {280// expected281}282}283284private static void testShiftRight() {285System.out.println("Testing BigInteger.shiftRight");286try {287BigInteger actual = MIN_VALUE.shiftRight(-1);288throw new RuntimeException("BigInteger.MIN_VALUE.shiftRight(-1).bitLength()=" + actual.bitLength());289} catch (ArithmeticException e) {290// expected291}292try {293BigInteger actual = MAX_VALUE.shiftRight(-1);294throw new RuntimeException("BigInteger.MAX_VALUE.shiftRight(-1).bitLength()=" + actual.bitLength());295} catch (ArithmeticException e) {296// expected297}298}299300private static void testAnd() {301System.out.println("Testing BigInteger.and");302check("BigInteger.MIN_VALUE.and(BigInteger.MIN_VALUE)",303MIN_VALUE.and(MIN_VALUE), MIN_VALUE);304check("BigInteger.MAX_VALUE.and(BigInteger.MAX_VALUE)",305MAX_VALUE.and(MAX_VALUE), MAX_VALUE);306check("BigInteger.MIN_VALUE.and(BigInteger.MAX_VALUE)",307MIN_VALUE.and(MAX_VALUE), BigInteger.ONE);308try {309BigInteger actual = MIN_VALUE.and(BigInteger.valueOf(-2));310throw new RuntimeException("BigInteger.MIN_VALUE.and(-2)).bitLength()=" + actual.bitLength());311} catch (ArithmeticException e) {312// expected313}314}315316private static void testOr() {317System.out.println("Testing BigInteger.or");318check("BigInteger.MIN_VALUE.or(BigInteger.MIN_VALUE)",319MIN_VALUE.or(MIN_VALUE), MIN_VALUE);320check("BigInteger.MAX_VALUE.or(BigInteger.MAX_VALUE)",321MAX_VALUE.or(MAX_VALUE), MAX_VALUE);322check("BigInteger.MIN_VALUE.and(BigInteger.MAX_VALUE)",323MIN_VALUE.or(MAX_VALUE), BigInteger.valueOf(-1));324}325326private static void testXor() {327System.out.println("Testing BigInteger.xor");328check("BigInteger.MIN_VALUE.xor(BigInteger.MIN_VALUE)",329MIN_VALUE.xor(MIN_VALUE), BigInteger.ZERO);330check("BigInteger.MAX_VALUE.xor(BigInteger.MAX_VALUE)",331MAX_VALUE.xor(MAX_VALUE), BigInteger.ZERO);332check("BigInteger.MIN_VALUE.xor(BigInteger.MAX_VALUE)",333MIN_VALUE.xor(MAX_VALUE), BigInteger.valueOf(-2));334try {335BigInteger actual = MIN_VALUE.xor(BigInteger.ONE);336throw new RuntimeException("BigInteger.MIN_VALUE.xor(BigInteger.ONE)).bitLength()=" + actual.bitLength());337} catch (ArithmeticException e) {338// expected339}340}341342private static void testNot() {343System.out.println("Testing BigInteger.not");344check("BigInteger.MIN_VALUE.not()",345MIN_VALUE.not(), MAX_VALUE.subtract(BigInteger.ONE));346try {347BigInteger actual = MAX_VALUE.not();348throw new RuntimeException("BigInteger.MAX_VALUE.not()).bitLength()=" + actual.bitLength());349} catch (ArithmeticException e) {350// expected351}352}353354private static void testSetBit() {355System.out.println("Testing BigInteger.setBit");356check("BigInteger.MIN_VALUE.setBit(" + Integer.MAX_VALUE + ")",357MIN_VALUE.setBit(Integer.MAX_VALUE), MIN_VALUE);358try {359BigInteger actual = MAX_VALUE.setBit(Integer.MAX_VALUE);360throw new RuntimeException("BigInteger.MAX_VALUE.setBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());361} catch (ArithmeticException e) {362// expected363}364}365366private static void testClearBit() {367System.out.println("Testing BigInteger.clearBit");368check("BigInteger.MAX_VALUE.clearBit(" + Integer.MAX_VALUE + ")",369MAX_VALUE.clearBit(Integer.MAX_VALUE), MAX_VALUE);370try {371BigInteger actual = MIN_VALUE.clearBit(Integer.MAX_VALUE);372throw new RuntimeException("BigInteger.MIN_VALUE.clearBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());373} catch (ArithmeticException e) {374// expected375}376try {377BigInteger actual = MIN_VALUE.clearBit(0);378throw new RuntimeException("BigInteger.MIN_VALUE.clearBit(0).bitLength()=" + actual.bitLength());379} catch (ArithmeticException e) {380// expected381}382}383384private static void testFlipBit() {385System.out.println("Testing BigInteger.flipBit");386try {387BigInteger actual = MIN_VALUE.flipBit(Integer.MAX_VALUE);388throw new RuntimeException("BigInteger.MIN_VALUE.flipBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());389} catch (ArithmeticException e) {390// expected391}392try {393BigInteger actual = MIN_VALUE.flipBit(0);394throw new RuntimeException("BigInteger.MIN_VALUE.flipBit(0).bitLength()=" + actual.bitLength());395} catch (ArithmeticException e) {396// expected397}398try {399BigInteger actual = MAX_VALUE.flipBit(Integer.MAX_VALUE);400throw new RuntimeException("BigInteger.MAX_VALUE.flipBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());401} catch (ArithmeticException e) {402// expected403}404}405406private static void testGetLowestSetBit() {407System.out.println("Testing BigInteger.getLowestSetBit");408check("BigInteger.MIN_VALUE.getLowestSetBit()",409MIN_VALUE.getLowestSetBit(), 0);410check("BigInteger.MAX_VALUE.getLowestSetBit()",411MAX_VALUE.getLowestSetBit(), 0);412}413414private static void testBitLength() {415System.out.println("Testing BigInteger.bitLength");416check("BigInteger.MIN_NEXT.bitLength()",417MIN_VALUE.bitLength(), Integer.MAX_VALUE);418check("BigInteger.MAX_VALUE.bitLength()",419MAX_VALUE.bitLength(), Integer.MAX_VALUE);420}421422private static void testBitCount() {423System.out.println("Testing BigInteger.bitCount");424check("BigInteger.MIN_VALUE.bitCount()",425MIN_VALUE.bitCount(), Integer.MAX_VALUE - 1);426check("BigInteger.MAX_VALUE.bitCount()",427MAX_VALUE.bitCount(), Integer.MAX_VALUE);428}429430private static void testToString(String msg, int radix, BigInteger bi, int length, String startsWith, char c) {431String s = bi.toString(radix);432if (s.length() != length) {433throw new RuntimeException(msg + ".length=" + s.length());434}435if (!s.startsWith(startsWith)) {436throw new RuntimeException(msg + "[0]=" + s.substring(0, startsWith.length()));437}438for (int i = startsWith.length(); i < s.length(); i++) {439if (s.charAt(i) != c) {440throw new RuntimeException(msg + "[" + i + "]='" + s.charAt(i) + "'");441}442}443}444445private static void testToString() {446System.out.println("Testing BigInteger.toString");447testToString("BigInteger.MIN_VALUE.toString(16)=", 16,448BigInteger.valueOf(-1).shiftLeft(Integer.MAX_VALUE - 1),449(1 << 29) + 1, "-4", '0');450}451452private static void testToByteArrayWithConstructor(String msg, BigInteger bi, int length, byte msb, byte b, byte lsb) {453byte[] ba = bi.toByteArray();454if (ba.length != length) {455throw new RuntimeException(msg + ".length=" + ba.length);456}457if (ba[0] != msb) {458throw new RuntimeException(msg + "[0]=" + ba[0]);459}460for (int i = 1; i < ba.length - 1; i++) {461if (ba[i] != b) {462throw new RuntimeException(msg + "[" + i + "]=" + ba[i]);463}464}465if (ba[ba.length - 1] != lsb) {466throw new RuntimeException(msg + "[" + (ba.length - 1) + "]=" + ba[ba.length - 1]);467}468BigInteger actual = new BigInteger(ba);469if (!actual.equals(bi)) {470throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());471}472}473474private static void testToByteArrayWithConstructor() {475System.out.println("Testing BigInteger.toByteArray with constructor");476testToByteArrayWithConstructor("BigInteger.MIN_VALUE.toByteArray()",477MIN_VALUE, (1 << 28), (byte) 0x80, (byte) 0x00, (byte) 0x01);478testToByteArrayWithConstructor("BigInteger.MAX_VALUE.toByteArray()",479MAX_VALUE, (1 << 28), (byte) 0x7f, (byte) 0xff, (byte) 0xff);480481byte[] ba = new byte[1 << 28];482ba[0] = (byte) 0x80;483try {484BigInteger actual = new BigInteger(-1, ba);485throw new RuntimeException("new BigInteger(-1, ba).bitLength()=" + actual.bitLength());486} catch (ArithmeticException e) {487// expected488}489try {490BigInteger actual = new BigInteger(1, ba);491throw new RuntimeException("new BigInteger(1, ba).bitLength()=" + actual.bitLength());492} catch (ArithmeticException e) {493// expected494}495}496497private static void testIntValue() {498System.out.println("Testing BigInteger.intValue");499check("BigInteger.MIN_VALUE.intValue()",500MIN_VALUE.intValue(), 1);501check("BigInteger.MAX_VALUE.floatValue()",502MAX_VALUE.intValue(), -1);503}504505private static void testLongValue() {506System.out.println("Testing BigInteger.longValue");507check("BigInteger.MIN_VALUE.longValue()",508MIN_VALUE.longValue(), 1L);509check("BigInteger.MAX_VALUE.longValue()",510MAX_VALUE.longValue(), -1L);511}512513private static void testFloatValue() {514System.out.println("Testing BigInteger.floatValue, Bug 8021203");515check("BigInteger.MIN_VALUE_.floatValue()",516MIN_VALUE.floatValue(), Float.NEGATIVE_INFINITY);517check("BigInteger.MAX_VALUE.floatValue()",518MAX_VALUE.floatValue(), Float.POSITIVE_INFINITY);519}520521private static void testDoubleValue() {522System.out.println("Testing BigInteger.doubleValue, Bug 8021203");523check("BigInteger.MIN_VALUE.doubleValue()",524MIN_VALUE.doubleValue(), Double.NEGATIVE_INFINITY);525check("BigInteger.MAX_VALUE.doubleValue()",526MAX_VALUE.doubleValue(), Double.POSITIVE_INFINITY);527}528529private static void testSerialization(String msg, BigInteger bi) {530try {531ByteArrayOutputStream baOut = new ByteArrayOutputStream((1 << 28) + 1000);532ObjectOutputStream out = new ObjectOutputStream(baOut);533out.writeObject(bi);534out.close();535out = null;536byte[] ba = baOut.toByteArray();537baOut = null;538ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(ba));539BigInteger actual = (BigInteger) in.readObject();540if (!actual.equals(bi)) {541throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());542}543} catch (IOException | ClassNotFoundException e) {544throw new RuntimeException(msg + " raised exception ", e);545}546}547548private static void testSerialization() {549System.out.println("Testing BigInteger serialization");550testSerialization("BigInteger.MIN_VALUE.intValue()",551MIN_VALUE);552testSerialization("BigInteger.MAX_VALUE.floatValue()",553MAX_VALUE);554}555556private static void testLongValueExact() {557System.out.println("Testing BigInteger.longValueExact");558try {559long actual = MIN_VALUE.longValueExact();560throw new RuntimeException("BigInteger.MIN_VALUE.longValueExact()= " + actual);561} catch (ArithmeticException e) {562// excpected563}564try {565long actual = MAX_VALUE.longValueExact();566throw new RuntimeException("BigInteger.MAX_VALUE.longValueExact()= " + actual);567} catch (ArithmeticException e) {568// excpected569}570}571572private static void testIntValueExact() {573System.out.println("Testing BigInteger.intValueExact");574try {575long actual = MIN_VALUE.intValueExact();576throw new RuntimeException("BigInteger.MIN_VALUE.intValueExact()= " + actual);577} catch (ArithmeticException e) {578// excpected579}580try {581long actual = MAX_VALUE.intValueExact();582throw new RuntimeException("BigInteger.MAX_VALUE.intValueExact()= " + actual);583} catch (ArithmeticException e) {584// excpected585}586}587588private static void testShortValueExact() {589System.out.println("Testing BigInteger.shortValueExact");590try {591long actual = MIN_VALUE.shortValueExact();592throw new RuntimeException("BigInteger.MIN_VALUE.shortValueExact()= " + actual);593} catch (ArithmeticException e) {594// excpected595}596try {597long actual = MAX_VALUE.shortValueExact();598throw new RuntimeException("BigInteger.MAX_VALUE.shortValueExact()= " + actual);599} catch (ArithmeticException e) {600// excpected601}602}603604private static void testByteValueExact() {605System.out.println("Testing BigInteger.byteValueExact");606try {607long actual = MIN_VALUE.byteValueExact();608throw new RuntimeException("BigInteger.MIN_VALUE.byteValueExact()= " + actual);609} catch (ArithmeticException e) {610// excpected611}612try {613long actual = MAX_VALUE.byteValueExact();614throw new RuntimeException("BigInteger.MAX_VALUE.byteValueExact()= " + actual);615} catch (ArithmeticException e) {616// excpected617}618}619620public static void main(String... args) {621testOverflowInMakePositive();622testBug8021204();623testOverflowInBitSieve();624testAdd();625testSubtract();626testMultiply();627testDivide();628testDivideAndRemainder();629testBug9005933();630testRemainder();631testPow();632testGcd();633testAbs();634testNegate();635testMod();636testModPow();637// testModInverse();638testShiftLeft();639testShiftRight();640testAnd();641testOr();642testXor();643testNot();644testSetBit();645testClearBit();646testFlipBit();647testGetLowestSetBit();648testBitLength();649testBitCount();650testToString();651testToByteArrayWithConstructor();652testIntValue();653testLongValue();654testFloatValue();655testDoubleValue();656testSerialization();657testLongValueExact();658testIntValueExact();659testShortValueExact();660testByteValueExact();661}662}663664665