class CommonUtils {

    public static Date dateFormat(final String dateInString, String formatFrom, String formatTo)
            throws java.text.ParseException {
        String dateDormatter = "MM/dd/yyyy";
        if (StringUtils.isNullOrEmpty(formatFrom)) {
            formatFrom = dateDormatter;
        }
        if (StringUtils.isNullOrEmpty(formatTo)) {
            formatTo = dateDormatter;
        }
        DateFormat dateFromFormater = new SimpleDateFormat(formatFrom);
        DateFormat dateToFormater = new SimpleDateFormat(formatTo);
        return dateToFormater.parse(dateToFormater.format(dateFromFormater.parse(dateInString)));
    }

}