@Test public void testTimeFormatterV2() throws Exception { }
public static String timeFormatterV2(Context context, long allMilli){ String result = ""; String plus = ""; if (allMilli<0){ plus = "-"; allMilli = allMilli* (-1); } long year = allMilli/31557600000L; long day = (allMilli%31557600000L)/86400000; long hour = ((allMilli%31557600000L)%86400000)/3600000; long minute = (((allMilli%31557600000L)%86400000)%3600000)/60000; long second = ((((allMilli%31557600000L)%86400000)%3600000)%60000)/1000; long milliSecond = ((((allMilli%31557600000L)%86400000)%3600000)%60000)%1000; if (year > 0) { result += formatWithSmartDecimal(year) + context.getResources().getString(R.string.year); if (day > 0) result += " " + formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); }else { if (day > 0) result += formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); if (hour > 0 || day > 0) result += " " + formatWithSmartDecimal(hour) + "h"; if (minute > 0 || hour > 0 || day > 0) result += " " + formatWithSmartDecimal(minute) + "min"; if (day == 0){ if (hour == 0){ if (minute >= 0){ if (second > 0){ result += " " + formatWithSmartDecimal(second) + "s"; } } if (minute == 0){ if (second >= 0){ if (milliSecond > 0){ result += " " + formatWithSmartDecimal(milliSecond) + "ms"; } } if (second == 0){ if (milliSecond == 0){ if (allMilli > 0){ result = "<1 ms"; }else{ result = "0 ms"; } } } } } } } return plus + result; }
Formater { public static String timeFormatterV2(Context context, long allMilli){ String result = ""; String plus = ""; if (allMilli<0){ plus = "-"; allMilli = allMilli* (-1); } long year = allMilli/31557600000L; long day = (allMilli%31557600000L)/86400000; long hour = ((allMilli%31557600000L)%86400000)/3600000; long minute = (((allMilli%31557600000L)%86400000)%3600000)/60000; long second = ((((allMilli%31557600000L)%86400000)%3600000)%60000)/1000; long milliSecond = ((((allMilli%31557600000L)%86400000)%3600000)%60000)%1000; if (year > 0) { result += formatWithSmartDecimal(year) + context.getResources().getString(R.string.year); if (day > 0) result += " " + formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); }else { if (day > 0) result += formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); if (hour > 0 || day > 0) result += " " + formatWithSmartDecimal(hour) + "h"; if (minute > 0 || hour > 0 || day > 0) result += " " + formatWithSmartDecimal(minute) + "min"; if (day == 0){ if (hour == 0){ if (minute >= 0){ if (second > 0){ result += " " + formatWithSmartDecimal(second) + "s"; } } if (minute == 0){ if (second >= 0){ if (milliSecond > 0){ result += " " + formatWithSmartDecimal(milliSecond) + "ms"; } } if (second == 0){ if (milliSecond == 0){ if (allMilli > 0){ result = "<1 ms"; }else{ result = "0 ms"; } } } } } } } return plus + result; } }
Formater { public static String timeFormatterV2(Context context, long allMilli){ String result = ""; String plus = ""; if (allMilli<0){ plus = "-"; allMilli = allMilli* (-1); } long year = allMilli/31557600000L; long day = (allMilli%31557600000L)/86400000; long hour = ((allMilli%31557600000L)%86400000)/3600000; long minute = (((allMilli%31557600000L)%86400000)%3600000)/60000; long second = ((((allMilli%31557600000L)%86400000)%3600000)%60000)/1000; long milliSecond = ((((allMilli%31557600000L)%86400000)%3600000)%60000)%1000; if (year > 0) { result += formatWithSmartDecimal(year) + context.getResources().getString(R.string.year); if (day > 0) result += " " + formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); }else { if (day > 0) result += formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); if (hour > 0 || day > 0) result += " " + formatWithSmartDecimal(hour) + "h"; if (minute > 0 || hour > 0 || day > 0) result += " " + formatWithSmartDecimal(minute) + "min"; if (day == 0){ if (hour == 0){ if (minute >= 0){ if (second > 0){ result += " " + formatWithSmartDecimal(second) + "s"; } } if (minute == 0){ if (second >= 0){ if (milliSecond > 0){ result += " " + formatWithSmartDecimal(milliSecond) + "ms"; } } if (second == 0){ if (milliSecond == 0){ if (allMilli > 0){ result = "<1 ms"; }else{ result = "0 ms"; } } } } } } } return plus + result; }  }
Formater { public static String timeFormatterV2(Context context, long allMilli){ String result = ""; String plus = ""; if (allMilli<0){ plus = "-"; allMilli = allMilli* (-1); } long year = allMilli/31557600000L; long day = (allMilli%31557600000L)/86400000; long hour = ((allMilli%31557600000L)%86400000)/3600000; long minute = (((allMilli%31557600000L)%86400000)%3600000)/60000; long second = ((((allMilli%31557600000L)%86400000)%3600000)%60000)/1000; long milliSecond = ((((allMilli%31557600000L)%86400000)%3600000)%60000)%1000; if (year > 0) { result += formatWithSmartDecimal(year) + context.getResources().getString(R.string.year); if (day > 0) result += " " + formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); }else { if (day > 0) result += formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); if (hour > 0 || day > 0) result += " " + formatWithSmartDecimal(hour) + "h"; if (minute > 0 || hour > 0 || day > 0) result += " " + formatWithSmartDecimal(minute) + "min"; if (day == 0){ if (hour == 0){ if (minute >= 0){ if (second > 0){ result += " " + formatWithSmartDecimal(second) + "s"; } } if (minute == 0){ if (second >= 0){ if (milliSecond > 0){ result += " " + formatWithSmartDecimal(milliSecond) + "ms"; } } if (second == 0){ if (milliSecond == 0){ if (allMilli > 0){ result = "<1 ms"; }else{ result = "0 ms"; } } } } } } } return plus + result; }  static String quantitatifFormatter(long quantitatif, String currencyName); static String big_quantitatifFormatter(BigInteger quantitatif, String currencyName); static String big_relatifFormatter(Context context, int decimal, BigDecimal relatif); static String timeFormatterV2(Context context, long allMilli); static String relatifFormatter(Context context, int decimal, double relatif); static String formatWithSmartDecimal(long amount); }
Formater { public static String timeFormatterV2(Context context, long allMilli){ String result = ""; String plus = ""; if (allMilli<0){ plus = "-"; allMilli = allMilli* (-1); } long year = allMilli/31557600000L; long day = (allMilli%31557600000L)/86400000; long hour = ((allMilli%31557600000L)%86400000)/3600000; long minute = (((allMilli%31557600000L)%86400000)%3600000)/60000; long second = ((((allMilli%31557600000L)%86400000)%3600000)%60000)/1000; long milliSecond = ((((allMilli%31557600000L)%86400000)%3600000)%60000)%1000; if (year > 0) { result += formatWithSmartDecimal(year) + context.getResources().getString(R.string.year); if (day > 0) result += " " + formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); }else { if (day > 0) result += formatWithSmartDecimal(day) + context.getResources().getString(R.string.day); if (hour > 0 || day > 0) result += " " + formatWithSmartDecimal(hour) + "h"; if (minute > 0 || hour > 0 || day > 0) result += " " + formatWithSmartDecimal(minute) + "min"; if (day == 0){ if (hour == 0){ if (minute >= 0){ if (second > 0){ result += " " + formatWithSmartDecimal(second) + "s"; } } if (minute == 0){ if (second >= 0){ if (milliSecond > 0){ result += " " + formatWithSmartDecimal(milliSecond) + "ms"; } } if (second == 0){ if (milliSecond == 0){ if (allMilli > 0){ result = "<1 ms"; }else{ result = "0 ms"; } } } } } } } return plus + result; }  static String quantitatifFormatter(long quantitatif, String currencyName); static String big_quantitatifFormatter(BigInteger quantitatif, String currencyName); static String big_relatifFormatter(Context context, int decimal, BigDecimal relatif); static String timeFormatterV2(Context context, long allMilli); static String relatifFormatter(Context context, int decimal, double relatif); static String formatWithSmartDecimal(long amount); static final String MAX_INTEGER; static final BigInteger MILLION; static final BigInteger MILLIARD; static final BigInteger BILLION; static final BigInteger BILLIARD; static final BigInteger TRILLION; static final BigInteger TRILLIARD; }