class DurationUnitsProvider extends AbstractUnitsProvider<Duration> {

    public Duration getLargestIntegerUnitType(Duration input)
    {
        Duration largest = null;
        for (Class<? extends Duration> type : getAvailableUnits(false))
        {
            try
            {
                Duration dur = Duration.create(type, input);
                BigDecimal durMag = dur.getMagnitude();
                if (durMag.stripTrailingZeros().scale() <= 0 && (largest == null || largest.getMagnitude().compareTo(durMag) > 0))
                {
                    largest = dur;
                }
            }
            catch (InvalidUnitsException e)
            {
                if (LOGGER.isTraceEnabled())
                {
                    LOGGER.trace("Invalid units encountered: " + e, e);
                }
            }
            catch (InconvertibleUnits e)
            {
                if (LOGGER.isTraceEnabled())
                {
                    LOGGER.trace("Inconvertible encountered: " + e, e);
                }
            }
        }

        return largest;
    }

    public  DurationUnitsProvider();

}