code: public static Duration getInstance(double duration, TimeUnit type)
     {
        Duration result;
        if (duration == 0)
        {
           result = ZERO_DURATIONS[type.getValue()];
        }
        else
        {
           result = new Duration(duration, type);
        }
        return (result);
     }
docs: Retrieve an Duration instance. Use shared objects to
  represent common values for memory efficiency.
  
  @param duration duration value
  @param type duration type
  @return Duration instance