1

        DateTimeFormatter formatter = new DateTimeFormatterBuilder()
                .appendPattern("yyyyMM")
                .parseDefaulting(ChronoField.DAY_OF_MONTH, 1)
                .toFormatter();
        LocalDate localDate = LocalDate.parse("202305", formatter);
        System.out.println(localDate);
        // 2023-05-01

2

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
        LocalDate localDate = YearMonth.parse("202206", formatter).atDay(1);
        System.out.println(localDate);
        // 2022-06-01