Code example for BigDecimal

Methods: equalshashCode

0
		hash2 = new BigDecimal(val, 2);
		assertTrue("hashCode of 1.00 and 1.00(bigInteger) is not equal", hash
				.hashCode() == hash2.hashCode()
				&& hash.equals(hash2));
		hash = new BigDecimal(value, 2);
		hash2 = new BigDecimal("-1233456.0000");
		assertTrue("hashCode of 123459.08 and -1233456.0000 is not equal", hash
				.hashCode() != hash2.hashCode()
				&& !hash.equals(hash2));
		hash2 = new BigDecimal(value.negate(), 2);
		assertTrue("hashCode of 123459.08 and -123459.08 is not equal", hash
				.hashCode() != hash2.hashCode()
				&& !hash.equals(hash2));
	} 
 
	/** 
	 * @tests java.math.BigDecimal#intValue() 
	 */ 
	public void test_intValue() { 
		BigDecimal int1 = new BigDecimal(value, 3);
Experience pair programming with AI  Get Codota for Java