Code example for DecimalFormat

Methods: format

0
		final Calendar c = Calendar.getInstance();
		c.setTimeInMillis(rmxb.getStartTime());
		final float hours = rmxb.getUptime() / (3600 * 1000f);
 
		NumberFormat f;
		f = new DecimalFormat("00");
		handle.println("Boot: " + Integer.toString(c.get(Calendar.YEAR)) + "-"
				+ f.format(1 + c.get(Calendar.MONTH)) + "-"
				+ f.format(c.get(Calendar.DATE)) + " "
				+ f.format(c.get(Calendar.HOUR_OF_DAY)) + ":"
				+ f.format(c.get(Calendar.MINUTE)) + ":"
				+ f.format(c.get(Calendar.SECOND)));
		f = new DecimalFormat("0.0");
		handle.println("Uptime: " + f.format(hours) + " hours");
	} 
 
}