public void ToInt32()
        {
            BigDecimal int1 = new BigDecimal(value, 3);

            Assert.IsTrue(int1.ToInt32() == 12345, "the int value of 12345.908 is not 12345");
            int1 = BigDecimal.Parse("1.99");
            Assert.IsTrue(int1.ToInt32() == 1, "the int value of 1.99 is not 1");
            int1 = BigDecimal.Parse("23423419083091823091283933");
            // ran JDK and found representation for the above was -249268259
            Assert.IsTrue(int1.ToInt32() == -249268259, "the int value of 23423419083091823091283933 is wrong");
            int1 = new BigDecimal(-1235D);
            Assert.IsTrue(int1.ToInt32() == -1235, "the int value of -1235 is not -1235");
        }
        public void BigDecimalSerialization()
        {
            // Regression for HARMONY-1896
            char[]     input = { '1', '5', '6', '7', '8', '7', '.', '0', '0' };
            BigDecimal bd    = BigDecimal.Parse(input, 0, 9);

            MemoryStream    bos = new MemoryStream();
            BinaryFormatter oos = new BinaryFormatter();

            oos.Serialize(bos, bd);

            MemoryStream bis = new MemoryStream(bos.ToArray());
            BigDecimal   nbd = (BigDecimal)oos.Deserialize(bis);

            Assert.AreEqual(bd.ToInt32(), nbd.ToInt32());
            Assert.AreEqual(bd.ToDouble(), nbd.ToDouble(), 0.0);
            Assert.AreEqual(bd.ToString(), nbd.ToString());
        }