System.out.println(EasyFormat.format(x, 10, 2)
+ " " + EasyFormat.format(y, 12, 4)
Even though Java's relatively new class "DecimalFormat" is a major help, it is often difficult to align columns in Java output. EasyFormat is intended to make column alignment and other formatting easy.
The output from the demo program shows a number of possibilities.
The following formatting functions return a string:
format(double, width, numDec)
(where the String patterns are defined in the Javadocs for Decimal Format)
In addition there is one function that returns a decmal which was inspired by Excel.
The functions are
public static, so a typical use would be:
You can down load the zip file to get all the files in the package. It includes the Java source, class, and jar files together with this file and the image on it.