code: public void timedWait(Object obj, long timeout)
           throws InterruptedException {
           if (timeout > 0) {
               long ms = toMillis(timeout);
               int ns = excessNanos(timeout, ms);
               obj.wait(ms, ns);
           }
       }
docs: Perform a timed <tt>Object.wait</tt> using this time unit.
  This is a convenience method that converts timeout arguments
  into the form required by the <tt>Object.wait</tt> method.
  
  <p>For example, you could implement a blocking <tt>poll</tt>
  method (see {@link BlockingQueue#poll BlockingQueue.poll})
  using:
  
  <pre>  public synchronized  Object poll(long timeout, TimeUnit unit) throws InterruptedException {
  while (empty) {
  unit.timedWait(this, timeout);
  ...
  }
  }</pre>
  
  @param obj the object to wait on
  @param timeout the maximum time to wait.
  @throws InterruptedException if interrupted while waiting.
  @see java.lang.Object#wait(long, int)