BigDecimal scale question

Ok, excuse the stupid question, I am having some difficulty with BigDecimal code.

BigDecimal testBigDecimal =new BigDecimal(22.245);

System.out.println("BigDecimal is: " + testBigDecimal);

Outputs...

22.245000000000000994759830064140260219573974609375

I only want it to 22.245 so I add the following code

testBigDecimal.setScale(3, BigDecimal.ROUND_FLOOR);

testBigDecimal.scale();

System.out.println("workOrder..." + testBigDecimal.abs());

which then outputs 22.245000000000000994759830064140260219573974609375

My question is how do I enforce scale so that the output will be

22.245?

Thanks

[753 byte] By [beginner2a] at [2007-11-26 23:50:25]
# 1
DecimalFormat or printf()... Don't confuse data with representation.
CeciNEstPasUnProgrammeura at 2007-7-11 15:28:02 > top of Java-index,Java Essentials,Java Programming...
# 2

BigDecimal is immutable, so setScale returns a new BigDecimal (it doesn't modify the BigDecimal itself) :testBigDecimal = testBigDecimal.setScale(3, BigDecimal.ROUND_FLOOR);

Note that you could also obtain your BigDecimal from a String:BigDecimal testBigDecimal = new BigDecimal("22.245");

TimTheEnchantora at 2007-7-11 15:28:02 > top of Java-index,Java Essentials,Java Programming...