Code =======================================================
float floattype=1000.00f;
Double doubletyep=11111111111111111.00d;
Date Datetype = new Date ();
String floatstr = String.Format ("%a,%e,%f,%g", Floattype,floattype,floattype,floattype);
String doublestr = String.Format ("%a,%e,%f,%g", Doubletyep,doubletyep,doubletyep,doubletyep);
String datastr = String.Format ("%1$tm-%1$te-%1$ty", Datetype);
System.out.println (FLOATSTR);
System.out.println (DOUBLESTR);
System.out.println (DATASTR);
===============================================================
Output Result:
0X1.F4P9, 1.000000e+03, 1000.000000, 1000.00
0X1.3BCBF936B38E4P53, 1.111111e+16, 11111111111111112.000000, 1.11111e+16
06-15-2009
where float type and double type of data, for the String.Format () method,
are all represented as floating-point numbers,
The format parameters you can use are as follows:
String.Format ("%a,%e,%f,%g", Floattype,floattype,floattype,floattype);
which
%a means hexadecimal representation
%e the expression of scientific notation
%f represents the normal 10 binary
%g represents the size of a value based on the actual type, or in the manner of%e, or by%f
For a date type:
Such as:
String datastr = String.Format ("%1$tm-%1$te-%1$ty", Datetype);
Where 1$ means that if there are more than one datetype in the argument, then which value in Datetype is taken,
T represents a date or time format,
M represents the month, E represents the day, and Y represents the year.
Problems with Java String.Format ()