class TimeFormatterUtil {

    public static String format(final Context context, final long milliseconds) {

        if (milliseconds < 0) {
            return "";
        }

        if (milliseconds == 0) {
            return context.getString(R.string.msdkui_minutes, 0);
        }

        final int seconds = (int) (milliseconds / SECOND_IN_MILLISECONDS);
        final int days = seconds / (HOUR_IN_SECONDS * DAY_IN_HOURS);
        final int hours = seconds / HOUR_IN_SECONDS % DAY_IN_HOURS;

        if (days > 0) {
            if (hours > 0) {
                return context.getString(R.string.msdkui_days_hours, days, hours);
            } else {
                return context.getString(R.string.msdkui_days, days);
            }
        }

        final int minutes = (seconds / MINUTE_IN_SECONDS) % MINUTE_IN_SECONDS;
        if (hours > 0) {
            if (minutes > 0) {
                return context.getString(R.string.msdkui_hours_minutes, hours, minutes);
            } else {
                return context.getString(R.string.msdkui_hours, hours);
            }
        }

        if (minutes > 0) {
            return context.getString(R.string.msdkui_minutes, minutes);
        }

        return context.getString(R.string.msdkui_seconds, (seconds / 10) * 10);
    }

    private  TimeFormatterUtil();

}