@Test
public void testFormatValue(){

	Assert.assertTrue(Double.valueOf("335.00")==335);
	long dec = LangUtils.hexToLong("BC092A11");
	Assert.assertEquals(3154717201L, dec);
	Object val = LangUtils.formatValue(0.755, "#0.00#");
	Assert.assertEquals("0.755", val);
	val = LangUtils.formatValue(1.9, "0.00");
	System.out.println("val: " + val);
	Assert.assertEquals("1.90", val);
	val = LangUtils.formatValue(0, "0.00");
	System.out.println("val: " + val);
	Assert.assertEquals("0.00", val);
	val = LangUtils.formatValue(0.755, "#.##");
	Assert.assertEquals("0.76", val);
	val = LangUtils.formatValue(1, "0.00");
	Assert.assertEquals("1.00", val);
	
	val = LangUtils.formatValue(0.755, "0.00");
	Assert.assertEquals("0.76", val);
	val = Double.parseDouble(String.format("%.2f",0.755));
	Assert.assertEquals("0.76", val.toString());
	
	val = LangUtils.formatValue(0.1, "0.00");
	Assert.assertEquals("0.10", val);
	val = LangUtils.formatValue(1253.1, "0.00");
	Assert.assertEquals("1253.10", val);
	val = LangUtils.formatValue(1253.1222222, "0.00");
	Assert.assertEquals("1253.12", val);
	val = LangUtils.formatValue(1253.1222222, "0");
	System.out.println("val1: " + val);
	Assert.assertEquals("1253", val);
	
	BigDecimal bd = new BigDecimal("1.44445");
	Assert.assertEquals("1.44", bd.setScale(2, RoundingMode.HALF_UP).toString());
	
	val = LangUtils.formatValue(-800.755, "0.00");
	//这个断言在jdk8之前的版本是可以通过的，jdk8后无法通过，详见：https://stackoverflow.com/questions/30778927/roundingmode-half-down-issue-in-java8
	// 实际上和小数无法精确表示有关，-800.755的ieee二进制表示是一个近似值-800.75499999999之类，即第三位之后其实少于5，所以HALF_UP后，应该是900.755
/		Assert.assertEquals("-800.76", val);
	Assert.assertEquals("-800.75", val);
	val = LangUtils.formatValue(-800.755, "#0.00元");
	//这个断言在jdk8之前的版本是可以通过的，jdk8后无法通过，详见：https://stackoverflow.com/questions/30778927/roundingmode-half-down-issue-in-java8
/		Assert.assertEquals("-800.76元", val);
	Assert.assertEquals("-800.75元", val);
}