@Override
    public String format(final long remaining) {
        StringBuilder b = new StringBuilder();
        if(remaining < 0) {
            // File sizes larger than advertised
            return LocaleFactory.localizedString("Unknown");
        }
        if(remaining > 7200) { // More than two hours
            b.append(MessageFormat.format(LocaleFactory.localizedString("{0} hours remaining", "Status"),
                    new BigDecimal(remaining).divide(new BigDecimal(3600), 1, BigDecimal.ROUND_DOWN).toString())
            );
        }
        else if(remaining > 120) { // More than two minutes
            b.append(MessageFormat.format(LocaleFactory.localizedString("{0} minutes remaining", "Status"),
                    String.valueOf((int) (remaining / 60)))
            );
        }
        else {
            b.append(MessageFormat.format(LocaleFactory.localizedString("{0} seconds remaining", "Status"),
                    String.valueOf((int) remaining))
            );
        }
        return b.toString();
    }
@Test
    public void testFormat() {
        RemainingPeriodFormatter f = new RemainingPeriodFormatter();
        assertEquals("5 seconds remaining", f.format(5L));
        assertEquals("5 minutes remaining", f.format(5 * 60));
        assertEquals("60 minutes remaining", f.format(60 * 60));
        assertEquals("120 minutes remaining", f.format(60 * 60 * 2));
        assertEquals("2.0 hours remaining", f.format(60 * 60 * 2 + 1));
        assertEquals("2.1 hours remaining", f.format(60 * 60 * 2 + 6 * 60));
    }