code: public static long getNextMidnight(Time recycle, long theTime, String tz) {
          if (recycle == null) {
              recycle = new Time();
          }
          recycle.timezone = tz;
          recycle.set(theTime);
          recycle.monthDay++;
          recycle.hour = 0;
          recycle.minute = 0;
          recycle.second = 0;
          return recycle.normalize(true);
      }
docs: Finds and returns the next midnight after "theTime" in milliseconds UTC
  
  @param recycle - Time object to recycle, otherwise null.
  @param theTime - Time used for calculations (in UTC)
  @param tz      The time zone to convert this time to.