code: public static Weeks from(TemporalAmount amount) {
          if (amount instanceof Weeks) {
              return (Weeks) amount;
          }
          Objects.requireNonNull(amount, "amount");
          int weeks = 0;
          for (TemporalUnit unit : amount.getUnits()) {
              long value = amount.get(unit);
              if (value != 0) {
                  long[] converted = Temporals.convertAmount(value, unit, WEEKS);
                  if (converted[1] != 0) {
                      throw new DateTimeException(
                              "Amount could not be converted to a whole number of weeks: " + value + " " + unit);
                  }
                  weeks = Math.addExact(weeks, Math.toIntExact(converted[0]));
              }
          }
          return of(weeks);
      }
docs: Obtains an instance of {@code Weeks} from a temporal amount.
  <p>
  This obtains an instance based on the specified amount.
  A {@code TemporalAmount} represents an amount of time, which may be
  date-based or time-based, which this factory extracts to a {@code Weeks}.
  <p>
  The result is calculated by looping around each unit in the specified amount.
  Each amount is converted to weeks using {@link Temporals#convertAmount}.
  If the conversion yields a remainder, an exception is thrown.
  If the amount is zero, the unit is ignored.
  For example, "7 days" can be converted to weeks but "6 days" cannot.
  
  @param amount  the temporal amount to convert, not null
  @return the equivalent amount, not null
  @throws DateTimeException if unable to convert to a {@code Weeks}
  @throws ArithmeticException if numeric overflow occurs