FileDocCategorySizeDatePackage
TempConverter3.javaAPI DocExample1161Sat Nov 25 12:56:06 GMT 2000None

TempConverter3

public class TempConverter3 extends TempConverter2

Fields Summary
protected FieldPosition
fp
protected DecimalFormat
dff
Constructors Summary
public TempConverter3()

		super();
		dff = new DecimalFormat("##.#");
		fp = new FieldPosition(NumberFormat.INTEGER_FIELD);
	
Methods Summary
public static voidmain(java.lang.String[] args)

		TempConverter t = new TempConverter3();
		t.start();
		t.data();
		t.end();
	
protected java.lang.StringprependSpaces(int n, java.lang.String s)

		String[] res = {
			"", " ", "  ", "   ", "    ", "     "
		};
		if (n<res.length)
			return res[n] + s;
		throw new IllegalStateException("Rebuild with bigger \"res\" array.");
	
protected voidprint(float f, float c)

		String fs = dff.format(f, new StringBuffer(), fp).toString();
		fs = prependSpaces(4 - fp.getEndIndex(), fs);

		String cs = df.format(c, new StringBuffer(), fp).toString();
		cs = prependSpaces(4 - fp.getEndIndex(), cs);

		System.out.println(fs + "  " + cs);