Here you can find the source of withZero(int aDay)
public static String withZero(int aDay)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String withZero(int aDay) { String pattern = "%d"; if (aDay < 10) pattern = "0%d"; return String.format(pattern, aDay); }/*w w w.j a v a2s . c o m*/ public static String format(String aFormat, long aDate) { SimpleDateFormat format = new SimpleDateFormat(aFormat); return format.format(new Date(aDate)); } }