Code example for BigDecimal

Methods: movePointRight

0
        } 
    } 
 
    // Throws OutOfMemoryError instead of ArithmeticException! 
    public void testMovePointRightEx2() { 
        BigDecimal a = new BigDecimal("123456789012345678901234567890123456789E25");
        try { 
            a.movePointRight(Integer.MAX_VALUE - 2);
            fail("ArithmeticException is not thrown");
        } catch (ArithmeticException expected) {
        } 
    } 
 
    public void testScaleByPowerOfTenEx() { 
        BigDecimal a = new BigDecimal("12345.6789012345678901234567890123456789");
        BigDecimal res = a.movePointRight(10);
        assertEquals("incorrect scale", 24, res.scale());
        assertEquals("incorrect value", "123456789012345.678901234567890123456789", res.toString());
        res = a.scaleByPowerOfTen(-50);
        assertEquals("incorrect scale", 84, res.scale());
        assertEquals("incorrect value", "1.23456789012345678901234567890123456789E-46", res.toString());