Code example for BigDecimal

Methods: equals

0
		assertTrue("the negate of 1233.4560000 is not -1233.4560000", negate1
				.negate().toString().equals("-1233.4560000"));
		negate1 = new BigDecimal("-23465839");
		assertTrue("the negate of -23465839 is not 23465839", negate1.negate()
				.toString().equals("23465839"));
		negate1 = new BigDecimal(-3.456E6);
		assertTrue("the negate of -3.456E6 is not 3.456E6", negate1.negate()
				.negate().equals(negate1));
	} 
 
	/** 
	 * @tests java.math.BigDecimal#scale() 
	 */ 
	public void test_scale() { 
		BigDecimal scale1 = new BigDecimal(value2, 8);
		assertTrue("the scale of the number 123.34560000 is wrong", scale1
				.scale() == 8);
		BigDecimal scale2 = new BigDecimal("29389.");
		assertTrue("the scale of the number 29389. is wrong",
				scale2.scale() == 0);
Connect your IDE to all the code out there  Get Codota for Java