Home | History | Annotate | Download | only in math
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 /**
     18  * @author Elena Semukhina
     19  * @version $Revision$
     20  */
     21 
     22 package org.apache.harmony.math.tests.java.math;
     23 
     24 import dalvik.annotation.TestTargetClass;
     25 import dalvik.annotation.TestTargets;
     26 import dalvik.annotation.TestLevel;
     27 import dalvik.annotation.TestTargetNew;
     28 
     29 import java.math.BigInteger;
     30 
     31 import junit.framework.TestCase;
     32 @TestTargetClass(BigInteger.class)
     33 /**
     34  * Class:   java.math.BigInteger
     35  * Methods: intValue, longValue, toByteArray(), valueOf(long val),
     36  * floatValue(), doubleValue()
     37  */
     38 public class BigIntegerConvertTest extends TestCase {
     39     /**
     40      * Return the double value of ZERO.
     41      */
     42     @TestTargetNew(
     43         level = TestLevel.PARTIAL_COMPLETE,
     44         notes = "This is a complete subset of tests for doubleValue method.",
     45         method = "doubleValue",
     46         args = {}
     47     )
     48     public void testDoubleValueZero() {
     49         String a = "0";
     50         double result = 0.0;
     51         double aNumber = new BigInteger(a).doubleValue();
     52         assertTrue(aNumber == result);
     53     }
     54 
     55     /**
     56      * Convert a positive number to a double value.
     57      * The number's length is less than 64 bits.
     58      */
     59     @TestTargetNew(
     60         level = TestLevel.PARTIAL_COMPLETE,
     61         notes = "This is a complete subset of tests for doubleValue method.",
     62         method = "doubleValue",
     63         args = {}
     64     )
     65     public void testDoubleValuePositive1() {
     66         String a = "27467238945";
     67         double result = 2.7467238945E10;
     68         double aNumber = new BigInteger(a).doubleValue();
     69         assertTrue(aNumber == result);
     70     }
     71 
     72     /**
     73      * Convert a positive number to a double value.
     74      * The number's bit length is inside [63, 1024].
     75      */
     76     @TestTargetNew(
     77         level = TestLevel.PARTIAL_COMPLETE,
     78         notes = "This is a complete subset of tests for doubleValue method.",
     79         method = "doubleValue",
     80         args = {}
     81     )
     82     public void testDoubleValuePositive2() {
     83         String a = "2746723894572364578265426346273456972";
     84         double result = 2.7467238945723645E36;
     85         double aNumber = new BigInteger(a).doubleValue();
     86         assertTrue(aNumber == result);
     87     }
     88 
     89     /**
     90      * Convert a negative number to a double value.
     91      * The number's bit length is less than 64 bits.
     92      */
     93     @TestTargetNew(
     94         level = TestLevel.PARTIAL_COMPLETE,
     95         notes = "This is a complete subset of tests for doubleValue method.",
     96         method = "doubleValue",
     97         args = {}
     98     )
     99     public void testDoubleValueNegative1() {
    100         String a = "-27467238945";
    101         double result = -2.7467238945E10;
    102         double aNumber = new BigInteger(a).doubleValue();
    103         assertTrue(aNumber == result);
    104     }
    105 
    106     /**
    107      * Convert a negative number to a double value.
    108      * The number's bit length is inside [63, 1024].
    109      */
    110     @TestTargetNew(
    111         level = TestLevel.PARTIAL_COMPLETE,
    112         notes = "This is a complete subset of tests for doubleValue method.",
    113         method = "doubleValue",
    114         args = {}
    115     )
    116     public void testDoubleValueNegative2() {
    117         String a = "-2746723894572364578265426346273456972";
    118         double result = -2.7467238945723645E36;
    119         double aNumber = new BigInteger(a).doubleValue();
    120         assertTrue(aNumber == result);
    121     }
    122 
    123     /**
    124      * Convert a positive number to a double value.
    125      * Rounding is needed.
    126      * The rounding bit is 1 and the next bit to the left is 1.
    127      */
    128     @TestTargetNew(
    129         level = TestLevel.PARTIAL_COMPLETE,
    130         notes = "This is a complete subset of tests for doubleValue method.",
    131         method = "doubleValue",
    132         args = {}
    133     )
    134     public void testDoubleValuePosRounded1() {
    135         byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
    136         int aSign = 1;
    137         double result = 1.54747264387948E26;
    138         double aNumber = new BigInteger(aSign, a).doubleValue();
    139         assertTrue(aNumber == result);
    140     }
    141 
    142     /**
    143      * Convert a positive number to a double value.
    144      * Rounding is needed.
    145      * The rounding bit is 1 and the next bit to the left is 0
    146      * but some of dropped bits are 1s.
    147      */
    148     @TestTargetNew(
    149         level = TestLevel.PARTIAL_COMPLETE,
    150         notes = "This is a complete subset of tests for doubleValue method.",
    151         method = "doubleValue",
    152         args = {}
    153     )
    154     public void testDoubleValuePosRounded2() {
    155         byte[] a = {-128, 1, 2, 3, 4, 5, 36, 23, 1, -3, -5};
    156         int aSign = 1;
    157         double result = 1.547472643879479E26;
    158         double aNumber = new BigInteger(aSign, a).doubleValue();
    159         assertTrue(aNumber == result);
    160     }
    161         /**
    162      * Convert a positive number to a double value.
    163      * Rounding is NOT needed.
    164      */
    165     @TestTargetNew(
    166         level = TestLevel.PARTIAL_COMPLETE,
    167         notes = "This is a complete subset of tests for doubleValue method.",
    168         method = "doubleValue",
    169         args = {}
    170     )
    171     public void testDoubleValuePosNotRounded() {
    172         byte[] a = {-128, 1, 2, 3, 4, 5, -128, 23, 1, -3, -5};
    173         int aSign = 1;
    174         double result = 1.5474726438794828E26;
    175         double aNumber = new BigInteger(aSign, a).doubleValue();
    176         assertTrue(aNumber == result);
    177     }
    178 
    179     /**
    180      * Convert a positive number to a double value.
    181      * Rounding is needed.
    182      */
    183     @TestTargetNew(
    184         level = TestLevel.PARTIAL_COMPLETE,
    185         notes = "This is a complete subset of tests for doubleValue method.",
    186         method = "doubleValue",
    187         args = {}
    188     )
    189     public void testDoubleValueNegRounded1() {
    190         byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
    191         int aSign = -1;
    192         double result = -1.54747264387948E26;
    193         double aNumber = new BigInteger(aSign, a).doubleValue();
    194         assertTrue(aNumber == result);
    195     }
    196 
    197     /**
    198      * Convert a positive number to a double value.
    199      * Rounding is needed.
    200      * The rounding bit is 1 and the next bit to the left is 0
    201      * but some of dropped bits are 1s.
    202      */
    203     @TestTargetNew(
    204         level = TestLevel.PARTIAL_COMPLETE,
    205         notes = "This is a complete subset of tests for doubleValue method.",
    206         method = "doubleValue",
    207         args = {}
    208     )
    209     public void testDoubleValueNegRounded2() {
    210         byte[] a = {-128, 1, 2, 3, 4, 5, 36, 23, 1, -3, -5};
    211         int aSign = -1;
    212         double result = -1.547472643879479E26;
    213         double aNumber = new BigInteger(aSign, a).doubleValue();
    214         assertTrue(aNumber == result);
    215     }
    216 
    217     /**
    218      * Convert a positive number to a double value.
    219      * Rounding is NOT needed.
    220      */
    221     @TestTargetNew(
    222         level = TestLevel.PARTIAL_COMPLETE,
    223         notes = "This is a complete subset of tests for doubleValue method.",
    224         method = "doubleValue",
    225         args = {}
    226     )
    227     public void testDoubleValueNegNotRounded() {
    228         byte[] a = {-128, 1, 2, 3, 4, 5, -128, 23, 1, -3, -5};
    229         int aSign = -1;
    230         double result = -1.5474726438794828E26;
    231         double aNumber = new BigInteger(aSign, a).doubleValue();
    232         assertTrue(aNumber == result);
    233     }
    234 
    235     /**
    236      * Convert a positive number to a double value.
    237      * The exponent is 1023 and the mantissa is all 1s.
    238      * The rounding bit is 0.
    239      * The result is Double.MAX_VALUE.
    240      */
    241     @TestTargetNew(
    242         level = TestLevel.PARTIAL_COMPLETE,
    243         notes = "This is a complete subset of tests for doubleValue method.",
    244         method = "doubleValue",
    245         args = {}
    246     )
    247     public void testDoubleValuePosMaxValue() {
    248         byte[] a = {0, -1, -1, -1, -1, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    249             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    250             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    251             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    252             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    253             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    254             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    255             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
    256            };
    257         int aSign = 1;
    258         double aNumber = new BigInteger(aSign, a).doubleValue();
    259         assertTrue(aNumber == Double.MAX_VALUE);
    260     }
    261 
    262     /**
    263      * Convert a negative number to a double value.
    264      * The exponent is 1023 and the mantissa is all 1s.
    265      * The result is -Double.MAX_VALUE.
    266      */
    267     @TestTargetNew(
    268         level = TestLevel.PARTIAL_COMPLETE,
    269         notes = "This is a complete subset of tests for doubleValue method.",
    270         method = "doubleValue",
    271         args = {}
    272     )
    273     public void testDoubleValueNegMaxValue() {
    274         byte[] a = {0, -1, -1, -1, -1, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    275             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    276             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    277             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    278             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    279             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    280             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    281             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
    282            };
    283         int aSign = -1;
    284         double aNumber = new BigInteger(aSign, a).doubleValue();
    285         assertTrue(aNumber == -Double.MAX_VALUE);
    286     }
    287 
    288     /**
    289      * Convert a positive number to a double value.
    290      * The exponent is 1023 and the mantissa is all 1s.
    291      * The rounding bit is 1.
    292      * The result is Double.POSITIVE_INFINITY.
    293      */
    294     @TestTargetNew(
    295         level = TestLevel.PARTIAL_COMPLETE,
    296         notes = "This is a complete subset of tests for doubleValue method.",
    297         method = "doubleValue",
    298         args = {}
    299     )
    300     public void testDoubleValuePositiveInfinity1() {
    301         byte[] a = {-1, -1, -1, -1, -1, -1, -1, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    302                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    303                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    304                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    305                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    306                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    307                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    308                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    309            };
    310         int aSign = 1;
    311         double aNumber = new BigInteger(aSign, a).doubleValue();
    312         assertTrue(aNumber == Double.POSITIVE_INFINITY);
    313     }
    314 
    315     /**
    316      * Convert a positive number to a double value.
    317      * The number's bit length is greater than 1024.
    318      */
    319     @TestTargetNew(
    320         level = TestLevel.PARTIAL_COMPLETE,
    321         notes = "This is a complete subset of tests for doubleValue method.",
    322         method = "doubleValue",
    323         args = {}
    324     )
    325     public void testDoubleValuePositiveInfinity2() {
    326         String a = "2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
    327         double aNumber = new BigInteger(a).doubleValue();
    328         assertTrue(aNumber == Double.POSITIVE_INFINITY);
    329     }
    330 
    331     /**
    332      * Convert a negative number to a double value.
    333      * The number's bit length is greater than 1024.
    334      */
    335     @TestTargetNew(
    336         level = TestLevel.PARTIAL_COMPLETE,
    337         notes = "This is a complete subset of tests for doubleValue method.",
    338         method = "doubleValue",
    339         args = {}
    340     )
    341     public void testDoubleValueNegativeInfinity1() {
    342         String a = "-2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
    343         double aNumber = new BigInteger(a).doubleValue();
    344         assertTrue(aNumber == Double.NEGATIVE_INFINITY);
    345     }
    346 
    347     /**
    348      * Convert a negative number to a double value.
    349      * The exponent is 1023 and the mantissa is all 0s.
    350      * The rounding bit is 0.
    351      * The result is Double.NEGATIVE_INFINITY.
    352      */
    353     @TestTargetNew(
    354         level = TestLevel.PARTIAL_COMPLETE,
    355         notes = "This is a complete subset of tests for doubleValue method.",
    356         method = "doubleValue",
    357         args = {}
    358     )
    359     public void testDoubleValueNegativeInfinity2() {
    360         byte[] a = {-1, -1, -1, -1, -1, -1, -1, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    361                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    362                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    363                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    364                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    365                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    366                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    367                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    368            };
    369         int aSign = -1;
    370         double aNumber = new BigInteger(aSign, a).doubleValue();
    371         assertTrue(aNumber == Double.NEGATIVE_INFINITY);
    372     }
    373 
    374     /**
    375      * Convert a positive number to a double value.
    376      * The exponent is 1023 and the mantissa is all 0s
    377      * but the 54th bit (implicit) is 1.
    378      */
    379     @TestTargetNew(
    380         level = TestLevel.PARTIAL_COMPLETE,
    381         notes = "This is a complete subset of tests for doubleValue method.",
    382         method = "doubleValue",
    383         args = {}
    384     )
    385     public void testDoubleValuePosMantissaIsZero() {
    386         byte[] a = {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    387                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    388                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    389                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    390                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    391                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    392                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    393                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    394            };
    395         int aSign = 1;
    396         double result = 8.98846567431158E307;
    397         double aNumber = new BigInteger(aSign, a).doubleValue();
    398         assertTrue(aNumber == result);
    399     }
    400 
    401     /**
    402      * Convert a positive number to a double value.
    403      * The exponent is 1023 and the mantissa is all 0s
    404      * but the 54th bit (implicit) is 1.
    405      */
    406     @TestTargetNew(
    407         level = TestLevel.PARTIAL_COMPLETE,
    408         notes = "This is a complete subset of tests for doubleValue method.",
    409         method = "doubleValue",
    410         args = {}
    411     )
    412     public void testDoubleValueNegMantissaIsZero() {
    413         byte[] a = {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    414                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    415                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    416                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    417                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    418                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    419                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    420                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    421            };
    422         int aSign = -1;
    423         double aNumber = new BigInteger(aSign, a).doubleValue();
    424         assertTrue(aNumber == -8.98846567431158E307);
    425     }
    426 
    427     /**
    428      * Return the float value of ZERO.
    429      */
    430     @TestTargetNew(
    431         level = TestLevel.PARTIAL_COMPLETE,
    432         notes = "This is a complete subset of tests for floatValue method.",
    433         method = "floatValue",
    434         args = {}
    435     )
    436     public void testFloatValueZero() {
    437         String a = "0";
    438         float result = 0.0f;
    439         float aNumber = new BigInteger(a).floatValue();
    440         assertTrue(aNumber == result);
    441     }
    442 
    443     /**
    444      * Convert a positive number to a float value.
    445      * The number's length is less than 32 bits.
    446      */
    447     @TestTargetNew(
    448         level = TestLevel.PARTIAL_COMPLETE,
    449         notes = "This is a complete subset of tests for floatValue method.",
    450         method = "floatValue",
    451         args = {}
    452     )
    453     public void testFloatValuePositive1() {
    454         String a = "27467238";
    455         float result = 2.7467238E7f;
    456         float aNumber = new BigInteger(a).floatValue();
    457         assertTrue(aNumber == result);
    458     }
    459 
    460     /**
    461      * Convert a positive number to a float value.
    462      * The number's bit length is inside [32, 127].
    463      */
    464     @TestTargetNew(
    465         level = TestLevel.PARTIAL_COMPLETE,
    466         notes = "This is a complete subset of tests for floatValue method.",
    467         method = "floatValue",
    468         args = {}
    469     )
    470     public void testFloatValuePositive2() {
    471         String a = "27467238945723645782";
    472         float result = 2.7467239E19f;
    473         float aNumber = new BigInteger(a).floatValue();
    474         assertTrue(aNumber == result);
    475     }
    476 
    477     /**
    478      * Convert a negative number to a float value.
    479      * The number's bit length is less than 32 bits.
    480      */
    481     @TestTargetNew(
    482         level = TestLevel.PARTIAL_COMPLETE,
    483         notes = "This is a complete subset of tests for floatValue method.",
    484         method = "floatValue",
    485         args = {}
    486     )
    487     public void testFloatValueNegative1() {
    488         String a = "-27467238";
    489         float result = -2.7467238E7f;
    490         float aNumber = new BigInteger(a).floatValue();
    491         assertTrue(aNumber == result);
    492     }
    493 
    494     /**
    495      * Convert a negative number to a doufloatble value.
    496      * The number's bit length is inside [63, 1024].
    497      */
    498     @TestTargetNew(
    499         level = TestLevel.PARTIAL_COMPLETE,
    500         notes = "This is a complete subset of tests for floatValue method.",
    501         method = "floatValue",
    502         args = {}
    503     )
    504     public void testFloatValueNegative2() {
    505         String a = "-27467238945723645782";
    506         float result = -2.7467239E19f;
    507         float aNumber = new BigInteger(a).floatValue();
    508         assertTrue(aNumber == result);
    509     }
    510 
    511     /**
    512      * Convert a positive number to a float value.
    513      * Rounding is needed.
    514      * The rounding bit is 1 and the next bit to the left is 1.
    515      */
    516     @TestTargetNew(
    517         level = TestLevel.PARTIAL_COMPLETE,
    518         notes = "This is a complete subset of tests for floatValue method.",
    519         method = "floatValue",
    520         args = {}
    521     )
    522     public void testFloatValuePosRounded1() {
    523         byte[] a = {-128, 1, -1, -4, 4, 5, 60, 23, 1, -3, -5};
    524         int aSign = 1;
    525         float result = 1.5475195E26f;
    526         float aNumber = new BigInteger(aSign, a).floatValue();
    527         assertTrue(aNumber == result);
    528     }
    529 
    530     /**
    531      * Convert a positive number to a float value.
    532      * Rounding is needed.
    533      * The rounding bit is 1 and the next bit to the left is 0
    534      * but some of dropped bits are 1s.
    535      */
    536     @TestTargetNew(
    537         level = TestLevel.PARTIAL_COMPLETE,
    538         notes = "This is a complete subset of tests for floatValue method.",
    539         method = "floatValue",
    540         args = {}
    541     )
    542     public void testFloatValuePosRounded2() {
    543         byte[] a = {-128, 1, 2, -128, 4, 5, 60, 23, 1, -3, -5};
    544         int aSign = 1;
    545         float result = 1.5474728E26f;
    546         float aNumber = new BigInteger(aSign, a).floatValue();
    547         assertTrue(aNumber == result);
    548     }
    549         /**
    550      * Convert a positive number to a float value.
    551      * Rounding is NOT needed.
    552      */
    553     @TestTargetNew(
    554         level = TestLevel.PARTIAL_COMPLETE,
    555         notes = "This is a complete subset of tests for floatValue method.",
    556         method = "floatValue",
    557         args = {}
    558     )
    559     public void testFloatValuePosNotRounded() {
    560         byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
    561         int aSign = 1;
    562         float result = 1.5474726E26f;
    563         float aNumber = new BigInteger(aSign, a).floatValue();
    564         assertTrue(aNumber == result);
    565     }
    566 
    567     /**
    568      * Convert a positive number to a float value.
    569      * Rounding is needed.
    570      */
    571     @TestTargetNew(
    572         level = TestLevel.PARTIAL_COMPLETE,
    573         notes = "This is a complete subset of tests for floatValue method.",
    574         method = "floatValue",
    575         args = {}
    576     )
    577     public void testFloatValueNegRounded1() {
    578         byte[] a = {-128, 1, -1, -4, 4, 5, 60, 23, 1, -3, -5};
    579         int aSign = -1;
    580         float result = -1.5475195E26f;
    581         float aNumber = new BigInteger(aSign, a).floatValue();
    582         assertTrue(aNumber == result);
    583     }
    584 
    585     /**
    586      * Convert a positive number to a float value.
    587      * Rounding is needed.
    588      * The rounding bit is 1 and the next bit to the left is 0
    589      * but some of dropped bits are 1s.
    590      */
    591     @TestTargetNew(
    592         level = TestLevel.PARTIAL_COMPLETE,
    593         notes = "This is a complete subset of tests for floatValue method.",
    594         method = "floatValue",
    595         args = {}
    596     )
    597     public void testFloatValueNegRounded2() {
    598         byte[] a = {-128, 1, 2, -128, 4, 5, 60, 23, 1, -3, -5};
    599         int aSign = -1;
    600         float result = -1.5474728E26f;
    601         float aNumber = new BigInteger(aSign, a).floatValue();
    602         assertTrue(aNumber == result);
    603     }
    604 
    605     /**
    606      * Convert a positive number to a float value.
    607      * Rounding is NOT needed.
    608      */
    609     @TestTargetNew(
    610         level = TestLevel.PARTIAL_COMPLETE,
    611         notes = "This is a complete subset of tests for floatValue method.",
    612         method = "floatValue",
    613         args = {}
    614     )
    615     public void testFloatValueNegNotRounded() {
    616         byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
    617         int aSign = -1;
    618         float result = -1.5474726E26f;
    619         float aNumber = new BigInteger(aSign, a).floatValue();
    620         assertTrue(aNumber == result);
    621     }
    622 
    623     /**
    624      * Convert a positive number to a float value.
    625      * The exponent is 1023 and the mantissa is all 1s.
    626      * The rounding bit is 0.
    627      * The result is Float.MAX_VALUE.
    628      */
    629     @TestTargetNew(
    630         level = TestLevel.PARTIAL_COMPLETE,
    631         notes = "This is a complete subset of tests for floatValue method.",
    632         method = "floatValue",
    633         args = {}
    634     )
    635     public void testFloatValuePosMaxValue() {
    636         byte[] a = {0, -1, -1, -1, 0, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1};
    637         int aSign = 1;
    638         float aNumber = new BigInteger(aSign, a).floatValue();
    639         assertTrue(aNumber == Float.MAX_VALUE);
    640     }
    641 
    642     /**
    643      * Convert a negative number to a float value.
    644      * The exponent is 1023 and the mantissa is all 1s.
    645      * The rounding bit is 0.
    646      * The result is -Float.MAX_VALUE.
    647      */
    648     @TestTargetNew(
    649         level = TestLevel.PARTIAL_COMPLETE,
    650         notes = "This is a complete subset of tests for floatValue method.",
    651         method = "floatValue",
    652         args = {}
    653     )
    654     public void testFloatValueNegMaxValue() {
    655         byte[] a = {0, -1, -1, -1, 0, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1};
    656         int aSign = -1;
    657         float aNumber = new BigInteger(aSign, a).floatValue();
    658         assertTrue(aNumber == -Float.MAX_VALUE);
    659     }
    660 
    661     /**
    662      * Convert a positive number to a float value.
    663      * The exponent is 1023 and the mantissa is all 1s.
    664      * The rounding bit is 1.
    665      * The result is Float.POSITIVE_INFINITY.
    666      */
    667     @TestTargetNew(
    668         level = TestLevel.PARTIAL_COMPLETE,
    669         notes = "This is a complete subset of tests for floatValue method.",
    670         method = "floatValue",
    671         args = {}
    672     )
    673     public void testFloatValuePositiveInfinity1() {
    674         byte[] a = {0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
    675         int aSign = 1;
    676         float aNumber = new BigInteger(aSign, a).floatValue();
    677         assertTrue(aNumber == Float.POSITIVE_INFINITY);
    678     }
    679 
    680     /**
    681      * Convert a positive number to a float value.
    682      * The number's bit length is greater than 127.
    683      */
    684     @TestTargetNew(
    685         level = TestLevel.PARTIAL_COMPLETE,
    686         notes = "This is a complete subset of tests for floatValue method.",
    687         method = "floatValue",
    688         args = {}
    689     )
    690     public void testFloatValuePositiveInfinity2() {
    691         String a = "2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
    692         float aNumber = new BigInteger(a).floatValue();
    693         assertTrue(aNumber == Float.POSITIVE_INFINITY);
    694     }
    695 
    696     /**
    697      * Convert a negative number to a float value.
    698      * The number's bit length is greater than 127.
    699      */
    700     @TestTargetNew(
    701         level = TestLevel.PARTIAL_COMPLETE,
    702         notes = "This is a complete subset of tests for floatValue method.",
    703         method = "floatValue",
    704         args = {}
    705     )
    706     public void testFloatValueNegativeInfinity1() {
    707         String a = "-2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
    708         float aNumber = new BigInteger(a).floatValue();
    709         assertTrue(aNumber == Float.NEGATIVE_INFINITY);
    710     }
    711 
    712     /**
    713      * Convert a negative number to a float value.
    714      * The exponent is 1023 and the mantissa is all 0s.
    715      * The rounding bit is 0.
    716      * The result is Float.NEGATIVE_INFINITY.
    717      */
    718     @TestTargetNew(
    719         level = TestLevel.PARTIAL_COMPLETE,
    720         notes = "This is a complete subset of tests for floatValue method.",
    721         method = "floatValue",
    722         args = {}
    723     )
    724     public void testFloatValueNegativeInfinity2() {
    725         byte[] a = {0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
    726         int aSign = -1;
    727         float aNumber = new BigInteger(aSign, a).floatValue();
    728         assertTrue(aNumber == Float.NEGATIVE_INFINITY);
    729     }
    730 
    731     /**
    732      * Convert a positive number to a float value.
    733      * The exponent is 1023 and the mantissa is all 0s
    734      * but the 54th bit (implicit) is 1.
    735      */
    736     @TestTargetNew(
    737         level = TestLevel.PARTIAL_COMPLETE,
    738         notes = "This is a complete subset of tests for floatValue method.",
    739         method = "floatValue",
    740         args = {}
    741     )
    742     public void testFloatValuePosMantissaIsZero() {
    743         byte[] a = {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    744         int aSign = 1;
    745         float result = 1.7014118E38f;
    746         float aNumber = new BigInteger(aSign, a).floatValue();
    747         assertTrue(aNumber == result);
    748     }
    749 
    750     /**
    751      * Convert a positive number to a double value.
    752      * The exponent is 1023 and the mantissa is all 0s
    753      * but the 54th bit (implicit) is 1.
    754      */
    755     @TestTargetNew(
    756         level = TestLevel.PARTIAL_COMPLETE,
    757         notes = "This is a complete subset of tests for floatValue method.",
    758         method = "floatValue",
    759         args = {}
    760     )
    761     public void testFloatValueNegMantissaIsZero() {
    762         byte[] a = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    763         int aSign = -1;
    764         float aNumber = new BigInteger(aSign, a).floatValue();
    765         assertTrue(aNumber == Float.NEGATIVE_INFINITY);
    766     }
    767 
    768     /**
    769      * Convert a negative number to a float value.
    770      * The number's bit length is less than 32 bits.
    771      */
    772     @TestTargetNew(
    773         level = TestLevel.PARTIAL_COMPLETE,
    774         notes = "This is a complete subset of tests for floatValue method.",
    775         method = "floatValue",
    776         args = {}
    777     )
    778     public void testFloatValueBug2482() {
    779         String a = "2147483649";
    780         float result = 2.14748365E9f;
    781         float aNumber = new BigInteger(a).floatValue();
    782         assertTrue(aNumber == result);
    783     }
    784 
    785     /**
    786      * Convert a positive BigInteger to an integer value.
    787      * The low digit is positive
    788      */
    789     @TestTargetNew(
    790         level = TestLevel.PARTIAL_COMPLETE,
    791         notes = "This is a complete subset of tests for intValue method.",
    792         method = "intValue",
    793         args = {}
    794     )
    795     public void testIntValuePositive1() {
    796         byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3};
    797         int resInt = 1496144643;
    798         int aNumber = new BigInteger(aBytes).intValue();
    799         assertTrue(aNumber == resInt);
    800     }
    801 
    802     /**
    803      * Convert a positive BigInteger to an integer value.
    804      * The low digit is positive
    805      */
    806     @TestTargetNew(
    807         level = TestLevel.PARTIAL_COMPLETE,
    808         notes = "This is a complete subset of tests for intValue method.",
    809         method = "intValue",
    810         args = {}
    811     )
    812     public void testIntValuePositive2() {
    813         byte aBytes[] = {12, 56, 100};
    814         int resInt = 800868;
    815         int aNumber = new BigInteger(aBytes).intValue();
    816         assertTrue(aNumber == resInt);
    817     }
    818 
    819     /**
    820      * Convert a positive BigInteger to an integer value.
    821      * The low digit is negative.
    822      */
    823     @TestTargetNew(
    824         level = TestLevel.PARTIAL_COMPLETE,
    825         notes = "This is a complete subset of tests for intValue method.",
    826         method = "intValue",
    827         args = {}
    828     )
    829     public void testIntValuePositive3() {
    830         byte aBytes[] = {56, 13, 78, -12, -5, 56, 100};
    831         int sign = 1;
    832         int resInt = -184862620;
    833         int aNumber = new BigInteger(sign, aBytes).intValue();
    834         assertTrue(aNumber == resInt);
    835     }
    836 
    837     /**
    838      * Convert a negative BigInteger to an integer value.
    839      * The low digit is negative.
    840      */
    841     @TestTargetNew(
    842         level = TestLevel.PARTIAL_COMPLETE,
    843         notes = "This is a complete subset of tests for intValue method.",
    844         method = "intValue",
    845         args = {}
    846     )
    847     public void testIntValueNegative1() {
    848         byte aBytes[] = {12, 56, 100, -2, -76, -128, 45, 91, 3};
    849         int sign = -1;
    850         int resInt = 2144511229;
    851         int aNumber = new BigInteger(sign, aBytes).intValue();
    852         assertTrue(aNumber == resInt);
    853     }
    854 
    855     /**
    856      * Convert a negative BigInteger to an integer value.
    857      * The low digit is negative.
    858      */
    859     @TestTargetNew(
    860         level = TestLevel.PARTIAL_COMPLETE,
    861         notes = "This is a complete subset of tests for intValue method.",
    862         method = "intValue",
    863         args = {}
    864     )
    865     public void testIntValueNegative2() {
    866         byte aBytes[] = {-12, 56, 100};
    867         int result = -771996;
    868         int aNumber = new BigInteger(aBytes).intValue();
    869         assertTrue(aNumber == result);
    870     }
    871 
    872     /**
    873      * Convert a negative BigInteger to an integer value.
    874      * The low digit is positive.
    875      */
    876     @TestTargetNew(
    877         level = TestLevel.PARTIAL_COMPLETE,
    878         notes = "This is a complete subset of tests for intValue method.",
    879         method = "intValue",
    880         args = {}
    881     )
    882     public void testIntValueNegative3() {
    883         byte aBytes[] = {12, 56, 100, -2, -76, 127, 45, 91, 3};
    884         int sign = -1;
    885         int resInt = -2133678851;
    886         int aNumber = new BigInteger(sign, aBytes).intValue();
    887         assertTrue(aNumber == resInt);
    888     }
    889 
    890     /**
    891      * Convert a BigInteger to a positive long value
    892      * The BigInteger is longer than int.
    893      */
    894     @TestTargetNew(
    895         level = TestLevel.PARTIAL_COMPLETE,
    896         notes = "This is a complete subset of tests for longValue method.",
    897         method = "longValue",
    898         args = {}
    899     )
    900     public void testLongValuePositive1() {
    901         byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, 120, -34, -12, 45, 98};
    902         long result = 3268209772258930018L;
    903         long aNumber = new BigInteger(aBytes).longValue();
    904         assertTrue(aNumber == result);
    905     }
    906 
    907     /**
    908      * Convert a number to a positive long value
    909      * The number fits in a long.
    910      */
    911     @TestTargetNew(
    912         level = TestLevel.PARTIAL_COMPLETE,
    913         notes = "This is a complete subset of tests for longValue method.",
    914         method = "longValue",
    915         args = {}
    916     )
    917     public void testLongValuePositive2() {
    918         byte aBytes[] = {12, 56, 100, 18, -105, 34, -18, 45};
    919         long result = 880563758158769709L;
    920         long aNumber = new BigInteger(aBytes).longValue();
    921         assertTrue(aNumber == result);
    922     }
    923 
    924     /**
    925      * Convert a number to a negative long value
    926      * The BigInteger is longer than int.
    927      */
    928     @TestTargetNew(
    929         level = TestLevel.PARTIAL_COMPLETE,
    930         notes = "This is a complete subset of tests for longValue method.",
    931         method = "longValue",
    932         args = {}
    933     )
    934     public void testLongValueNegative1() {
    935         byte aBytes[] = {12, -1, 100, -2, -76, -128, 45, 91, 3};
    936         long result = -43630045168837885L;
    937         long aNumber = new BigInteger(aBytes).longValue();
    938         assertTrue(aNumber == result);
    939     }
    940 
    941     /**
    942      * Convert a number to a negative long value
    943      * The number fits in a long.
    944      */
    945     @TestTargetNew(
    946         level = TestLevel.PARTIAL_COMPLETE,
    947         notes = "This is a complete subset of tests for longValue method.",
    948         method = "longValue",
    949         args = {}
    950     )
    951     public void testLongValueNegative2() {
    952         byte aBytes[] = {-12, 56, 100, 45, -101, 45, 98};
    953         long result = -3315696807498398L;
    954         long aNumber = new BigInteger(aBytes).longValue();
    955         assertTrue(aNumber == result);
    956     }
    957 
    958     /**
    959      * valueOf (long val): convert Integer.MAX_VALUE to a BigInteger.
    960      */
    961     @TestTargetNew(
    962         level = TestLevel.PARTIAL_COMPLETE,
    963         notes = "This is a complete subset of tests for valueOf method.",
    964         method = "valueOf",
    965         args = {long.class}
    966     )
    967     public void testValueOfIntegerMax() {
    968         long longVal = Integer.MAX_VALUE;
    969         BigInteger aNumber = BigInteger.valueOf(longVal);
    970         byte rBytes[] = {127, -1, -1, -1};
    971         byte resBytes[] = new byte[rBytes.length];
    972         resBytes = aNumber.toByteArray();
    973         for(int i = 0; i < resBytes.length; i++) {
    974             assertTrue(resBytes[i] == rBytes[i]);
    975         }
    976         assertEquals("incorrect sign", 1, aNumber.signum());
    977     }
    978 
    979     /**
    980      * valueOf (long val): convert Integer.MIN_VALUE to a BigInteger.
    981      */
    982     @TestTargetNew(
    983         level = TestLevel.PARTIAL_COMPLETE,
    984         notes = "This is a complete subset of tests for valueOf method.",
    985         method = "valueOf",
    986         args = {long.class}
    987     )
    988     public void testValueOfIntegerMin() {
    989         long longVal = Integer.MIN_VALUE;
    990         BigInteger aNumber = BigInteger.valueOf(longVal);
    991         byte rBytes[] = {-128, 0, 0, 0};
    992         byte resBytes[] = new byte[rBytes.length];
    993         resBytes = aNumber.toByteArray();
    994         for(int i = 0; i < resBytes.length; i++) {
    995             assertTrue(resBytes[i] == rBytes[i]);
    996         }
    997         assertEquals("incorrect sign", -1, aNumber.signum());
    998     }
    999 
   1000     /**
   1001      * valueOf (long val): convert Long.MAX_VALUE to a BigInteger.
   1002      */
   1003     @TestTargetNew(
   1004         level = TestLevel.PARTIAL_COMPLETE,
   1005         notes = "This is a complete subset of tests for valueOf method.",
   1006         method = "valueOf",
   1007         args = {long.class}
   1008     )
   1009     public void testValueOfLongMax() {
   1010         long longVal = Long.MAX_VALUE;
   1011         BigInteger aNumber = BigInteger.valueOf(longVal);
   1012         byte rBytes[] = {127, -1, -1, -1, -1, -1, -1, -1};
   1013         byte resBytes[] = new byte[rBytes.length];
   1014         resBytes = aNumber.toByteArray();
   1015         for(int i = 0; i < resBytes.length; i++) {
   1016             assertTrue(resBytes[i] == rBytes[i]);
   1017         }
   1018         assertEquals("incorrect sign", 1, aNumber.signum());
   1019     }
   1020 
   1021     /**
   1022      * valueOf (long val): convert Long.MIN_VALUE to a BigInteger.
   1023      */
   1024     @TestTargetNew(
   1025         level = TestLevel.PARTIAL_COMPLETE,
   1026         notes = "This is a complete subset of tests for valueOf method.",
   1027         method = "valueOf",
   1028         args = {long.class}
   1029     )
   1030     public void testValueOfLongMin() {
   1031         long longVal = Long.MIN_VALUE;
   1032         BigInteger aNumber = BigInteger.valueOf(longVal);
   1033         byte rBytes[] = {-128, 0, 0, 0, 0, 0, 0, 0};
   1034         byte resBytes[] = new byte[rBytes.length];
   1035         resBytes = aNumber.toByteArray();
   1036         for(int i = 0; i < resBytes.length; i++) {
   1037             assertTrue(resBytes[i] == rBytes[i]);
   1038         }
   1039         assertEquals("incorrect sign", -1, aNumber.signum());
   1040     }
   1041 
   1042     /**
   1043      * valueOf (long val): convert a positive long value to a BigInteger.
   1044      */
   1045     @TestTargetNew(
   1046         level = TestLevel.PARTIAL_COMPLETE,
   1047         notes = "This is a complete subset of tests for valueOf method.",
   1048         method = "valueOf",
   1049         args = {long.class}
   1050     )
   1051     public void testValueOfLongPositive1() {
   1052         long longVal = 268209772258930018L;
   1053         BigInteger aNumber = BigInteger.valueOf(longVal);
   1054         byte rBytes[] = {3, -72, -33, 93, -24, -56, 45, 98};
   1055         byte resBytes[] = new byte[rBytes.length];
   1056         resBytes = aNumber.toByteArray();
   1057         for(int i = 0; i < resBytes.length; i++) {
   1058             assertTrue(resBytes[i] == rBytes[i]);
   1059         }
   1060         assertEquals("incorrect sign", 1, aNumber.signum());
   1061     }
   1062 
   1063     /**
   1064      * valueOf (long val): convert a positive long value to a BigInteger.
   1065      * The long value fits in integer.
   1066      */
   1067     @TestTargetNew(
   1068         level = TestLevel.PARTIAL_COMPLETE,
   1069         notes = "This is a complete subset of tests for valueOf method.",
   1070         method = "valueOf",
   1071         args = {long.class}
   1072     )
   1073     public void testValueOfLongPositive2() {
   1074         long longVal = 58930018L;
   1075         BigInteger aNumber = BigInteger.valueOf(longVal);
   1076         byte rBytes[] = {3, -125, 51, 98};
   1077         byte resBytes[] = new byte[rBytes.length];
   1078         resBytes = aNumber.toByteArray();
   1079         for(int i = 0; i < resBytes.length; i++) {
   1080             assertTrue(resBytes[i] == rBytes[i]);
   1081         }
   1082         assertEquals("incorrect sign", 1, aNumber.signum());
   1083     }
   1084 
   1085     /**
   1086      * valueOf (long val): convert a negative long value to a BigInteger.
   1087      */
   1088     @TestTargetNew(
   1089         level = TestLevel.PARTIAL_COMPLETE,
   1090         notes = "This is a complete subset of tests for valueOf method.",
   1091         method = "valueOf",
   1092         args = {long.class}
   1093     )
   1094     public void testValueOfLongNegative1() {
   1095         long longVal = -268209772258930018L;
   1096         BigInteger aNumber = BigInteger.valueOf(longVal);
   1097         byte rBytes[] = {-4, 71, 32, -94, 23, 55, -46, -98};
   1098         byte resBytes[] = new byte[rBytes.length];
   1099         resBytes = aNumber.toByteArray();
   1100         for(int i = 0; i < resBytes.length; i++) {
   1101             assertTrue(resBytes[i] == rBytes[i]);
   1102         }
   1103         assertEquals("incorrect sign", -1, aNumber.signum());
   1104     }
   1105 
   1106     /**
   1107      * valueOf (long val): convert a negative long value to a BigInteger.
   1108      * The long value fits in integer.
   1109      */
   1110     @TestTargetNew(
   1111         level = TestLevel.PARTIAL_COMPLETE,
   1112         notes = "This is a complete subset of tests for valueOf method.",
   1113         method = "valueOf",
   1114         args = {long.class}
   1115     )
   1116     public void testValueOfLongNegative2() {
   1117         long longVal = -58930018L;
   1118         BigInteger aNumber = BigInteger.valueOf(longVal);
   1119         byte rBytes[] = {-4, 124, -52, -98};
   1120         byte resBytes[] = new byte[rBytes.length];
   1121         resBytes = aNumber.toByteArray();
   1122         for(int i = 0; i < resBytes.length; i++) {
   1123             assertTrue(resBytes[i] == rBytes[i]);
   1124         }
   1125         assertEquals("incorrect sign", -1, aNumber.signum());
   1126     }
   1127     /**
   1128      * valueOf (long val): convert a zero long value to a BigInteger.
   1129      */
   1130     @TestTargetNew(
   1131         level = TestLevel.PARTIAL_COMPLETE,
   1132         notes = "This is a complete subset of tests for valueOf method.",
   1133         method = "valueOf",
   1134         args = {long.class}
   1135     )
   1136     public void testValueOfLongZero() {
   1137         long longVal = 0L;
   1138         BigInteger aNumber = BigInteger.valueOf(longVal);
   1139         byte rBytes[] = {0};
   1140         byte resBytes[] = new byte[rBytes.length];
   1141         resBytes = aNumber.toByteArray();
   1142         for(int i = 0; i < resBytes.length; i++) {
   1143             assertTrue(resBytes[i] == rBytes[i]);
   1144         }
   1145         assertEquals("incorrect sign", 0, aNumber.signum());
   1146     }
   1147 }
   1148