代码语言:javascript
复制
@Test
public void testDecimalFormat() {
System.out.println(format("####.##", new BigDecimal("0012.00")));// 12
System.out.println(format("0000.00", new BigDecimal("0012.00")));// 0012.00
System.out.println(format("#00.00", new BigDecimal("0012.00")));// 12.00
System.out.println(format("000.00", new BigDecimal("0012.00")));// 012.00
System.out.println(format("#.00", new BigDecimal("0012.00")));// 12.00
System.out.println(format("0.00", new BigDecimal("0012.00")));// 12.00
}