code: public static @CheckForNull String getValidTimezone(String timezone) {
          String[] validIDs = TimeZone.getAvailableIDs();
          for (String str : validIDs) {
                if (str != null && str.equals(timezone)) {
                      return timezone;
                }
          }
          return null;
      }
docs: Checks if given timezone string is supported by TimeZone and returns
  the same string if valid, null otherwise
  @since 1.615