code: public static long parsePositiveTimePeriod(String period)
     {
        long retval = parseTimePeriod(period);
        if (retval < 0)
        {
           throw new NumberFormatException("Negative input time period: '" + period + "'");
        }
        return retval;
     }
docs: Same like parseTimePeriod(), but guards for negative entries.
  
  @param period the stringfied time period
  @return the parsed time period as long
  @throws NumberFormatException