01: /*
02: * Created on Dec 20, 2004
03: */
04: package uk.org.ponder.doubleutil;
05:
06: import java.text.DecimalFormat;
07:
08: /**
09: * @author Antranig Basman (amb26@ponder.org.uk)
10: *
11: */
12: public class DoubleFormat {
13: private static ThreadLocal formatlocal = new ThreadLocal() {
14: public Object initialValue() {
15: return new DecimalFormat("0.0000");
16: }
17: };
18:
19: public static String format4(double val) {
20: return getFormat4().format(val);
21: }
22:
23: public static DecimalFormat getFormat4() {
24: return (DecimalFormat) formatlocal.get();
25: }
26: }
|