import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Locale;

class Main {
    public static void main(String[] args) {
        DateTimeFormatter parser = DateTimeFormatter.ofPattern("MM/dd/uuuu", Locale.ENGLISH);
        String arr[] = {
                "120/12/2013", // 120 will be discarded against MM
                "23/12/2013", // Month can not be outside the range 1-12
                "Jan/12/2013", // Jan will discarded against MM. Requires MMM
                "12/31/2022", // Will be parsed normally
                "02/31/2022" // Will be parsed to 2022-02-28
        };
        for (String s : arr) {
            try {
                System.out.println("===========================");
                System.out.println("Trying to parse " + s + " using the format MM/dd/uuuu");
                System.out.println("Parsed to " + LocalDate.parse(s, parser));
            } catch (DateTimeParseException e) {
                System.out.println(e.getMessage());
                // throw e;
            }
        }
    }
}