tz = (TimeZone) timezones().get(tzBasename); if (tz != null && tz.getRawOffset() == gmtOffset && tz.useDaylightTime()) return tz; }
TimeZone tz = (TimeZone) timezones().get(stdName); if (tz != null) if (tz.getRawOffset() == stdOffs && tz.useDaylightTime()) return tz;   return new SimpleTimeZone(stdOffs, stdName);
  static TimeZone getDefaultTimeZone(String sysTimeZoneId)  {    // First find start of GMT offset info and any Daylight zone name.    int startGMToffset = 0;    int sysTimeZoneIdLength = sysTimeZoneId.length();    for (int i = 0; i < sysTimeZoneIdLength && startGMToffset == 0; i++)      {	char c = sysTimeZoneId.charAt(i);	if (Character.isDigit(c))	  startGMToffset = i;	else if ((c == '+' || c == '-')		 && i + 1 < sysTimeZoneIdLength		 && Character.isDigit(sysTimeZoneId.charAt(i + 1)))	  startGMToffset = i;      }        String tzBasename;    if (startGMToffset == 0)      tzBasename = sysTimeZoneId;    else      tzBasename = sysTimeZoneId.substring (0, startGMToffset);    int startDaylightZoneName = 0;    for (int i = sysTimeZoneIdLength - 1;	 i >= 0 && !Character.isDigit(sysTimeZoneId.charAt(i)); --i)      startDaylightZoneName = i;        boolean useDaylightTime = startDaylightZoneName > 0;        // Integer.parseInt() doesn't handle leading +.    if (sysTimeZoneId.charAt(startGMToffset) == '+')      startGMToffset++;        int gmtOffset = 0;    if (startGMToffset > 0)      {	gmtOffset = Integer.parseInt	  (startDaylightZoneName == 0	   ? sysTimeZoneId.substring(startGMToffset)	   : sysTimeZoneId.substring(startGMToffset,				     startDaylightZoneName));		// Offset could be in hours or seconds.  Convert to millis.	// The offset is given as the time to add to local time to get GMT	// we need the time to add to GMT to get localtime.	if (Math.abs(gmtOffset) < 24)	  gmtOffset *= 60 * 60;	gmtOffset *= -1000;      }        // Try to be optimistic and get the timezone that matches the base name.    // If we only have the base name then just accept this timezone.    // Otherwise check the gmtOffset and day light attributes.    TimeZone tz = (TimeZone) timezones().get(tzBasename);    if (tz != null	&& (tzBasename == sysTimeZoneId	    || (tz.getRawOffset() == gmtOffset		&& tz.useDaylightTime() == useDaylightTime)))      return tz;    // Maybe there is one with the daylight zone name?    if (useDaylightTime)      {	String daylightZoneName;	daylightZoneName = sysTimeZoneId.substring(startDaylightZoneName);	if (!daylightZoneName.equals(tzBasename))	  {	    tz = (TimeZone) timezones().get(tzBasename);	    if (tz != null		&& tz.getRawOffset() == gmtOffset		&& tz.useDaylightTime())	      return tz;	  }		}    // If no match, see if a valid timezone has similar attributes as this    // and then use it instead. We take the first one that looks OKish.    if (startGMToffset > 0)      {	String[] ids = getAvailableIDs(gmtOffset);	for (int i = 0; i < ids.length; i++)	  {	    tz = (TimeZone) timezones().get(ids[i]);	    if (tz.useDaylightTime() == useDaylightTime)	      return tz;	  }	}		return null;	}