Code example for BigInteger

Methods: equals

0
        BigDecimal big = new BigDecimal(value);
        assertTrue("the BigDecimal value is not initialized properly",
                big.unscaledValue().equals(value)
                && big.scale() == 0);
 
        BigInteger value2 = new BigInteger("12334560000");
        BigDecimal big2 = new BigDecimal(value2, 5);
        assertTrue("the BigDecimal value is not initialized properly",
                big2.unscaledValue().equals(value2)
                && big2.scale() == 5);
        assertTrue("the BigDecimal value is not represented properly", big2.toString().equals(
                "123345.60000")); 
    } 
 
    /** 
     * java.math.BigDecimal#BigDecimal(double) 
     */ 
    public void test_Constructor_Double() { 
        BigDecimal big = new BigDecimal(123E04);
        assertTrue("the BigDecimal value taking a double argument is not initialized properly", big
                .toString().equals("1230000"));