The Answer to Life, the Universe, and Everything

Monday, August 13, 2007

Formats decimal numbers by Java

DecimalFormat df = new DecimalFormat("0000");
df.format(77);
#OUTPUT: 0077


DecimalFormat df = new DecimalFormat("####");
df.format(77);
#OUTPUT: 77


DecimalFormat df = new DecimalFormat("####%");
df.format(77);
#OUTPUT: 77%


DecimalFormat df = new DecimalFormat("'AA'####%");
df.format(77);
#OUTPUT: AA77%


DecimalFormat df = new DecimalFormat("\u00A5###,###");
df.format(7777);
#OUTPUT: \7,777

Thursday, August 02, 2007

Struts2 by Maven for Eclipse


mvn archetype:create -DgroupId=tutorial \
-DartifactId=tutorial \
-DarchetypeGroupId=org.apache.struts \
-DarchetypeArtifactId=struts2-archetype-starter \
-DarchetypeVersion=2.0.1-SNAPSHOT \
-DremoteRepositories=http://people.apache.org/maven-snapshot-repository

cd tutorial
mvn -Dwtpversion=1.0 eclipse:eclipse