static JapaneseDate ofYearDay(JapaneseEra era, int yearOfEra, int dayOfYear) {
        Jdk8Methods.requireNonNull(era, "era");
        if (yearOfEra < 1) {
            throw new DateTimeException("Invalid YearOfEra: " + yearOfEra);
        }
        LocalDate eraStartDate = era.startDate();
        LocalDate eraEndDate = era.endDate();
        if (yearOfEra == 1) {
            dayOfYear += eraStartDate.getDayOfYear() - 1;
            if (dayOfYear > eraStartDate.lengthOfYear()) {
                throw new DateTimeException("DayOfYear exceeds maximum allowed in the first year of era " + era);
            }
        }
        int yearOffset = eraStartDate.getYear() - 1;
        LocalDate isoDate = LocalDate.ofYearDay(yearOfEra + yearOffset, dayOfYear);
        if (isoDate.isBefore(eraStartDate) || isoDate.isAfter(eraEndDate)) {
            throw new DateTimeException("Requested date is outside bounds of era " + era);
        }
        return new JapaneseDate(era, yearOfEra, isoDate);
    }
static JapaneseDate ofYearDay ( JapaneseEra era , int yearOfEra , int dayOfYear ) { Jdk8Methods . requireNonNull ( era , "era" ) ; if ( yearOfEra < 1 ) { throw new DateTimeException ( "Invalid YearOfEra: " + yearOfEra ) ; } LocalDate eraStartDate = era . startDate ( ) ; LocalDate eraEndDate = era . endDate ( ) ; if ( yearOfEra == 1 ) { dayOfYear += eraStartDate . getDayOfYear ( ) - 1 ; if ( dayOfYear > eraStartDate . lengthOfYear ( ) ) { throw new DateTimeException ( "DayOfYear exceeds maximum allowed in the first year of era " + era ) ; } } int yearOffset = eraStartDate . getYear ( ) - 1 ; LocalDate isoDate = LocalDate . ofYearDay ( yearOfEra + yearOffset , dayOfYear ) ; if ( isoDate . isBefore ( eraStartDate ) || isoDate . isAfter ( eraEndDate ) ) { throw new DateTimeException ( "Requested date is outside bounds of era " + era ) ; } return new JapaneseDate ( era , yearOfEra , isoDate ) ; }
Obtains a {@code JapaneseDate} representing a date in the Japanese calendar
system from the era, year-of-era and day-of-year fields.
<p>
This returns a {@code JapaneseDate} with the specified fields.
The day must be valid for the year, otherwise an exception will be thrown.
The Japanese day-of-year is reset when the era changes.

@param era  the Japanese era, not null
@param yearOfEra  the Japanese year-of-era
@param dayOfYear  the Japanese day-of-year, from 1 to 31
@return the date in Japanese calendar system, not null
@throws DateTimeException if the value of any field is out of range,
or if the day-of-year is invalid for the year