The Java se 8 API for for normalize()
reads:
This normalizes the years and months units, leaving the days unit unchanged. The months unit is adjusted to have an absolute value less than 11, with the years unit being adjusted to compensate. For example, a period of "1 Year and 15 months" will be normalized to "2 years and 3 months". The sign of the years and months units will be the same after normalization. For example, a period of "1 year and -25 months" will be normalized to "-1 year and -1 month".
public static void main(String[] args) {
Consumer<Period> nlz = d -> System.out.println(d.normalized());
nlz.accept(Period.of( 50, 10, -100)); // case 1
nlz.accept(Period.of(-50, 10, -100)); // case 2
}
/*
program output
--------------
P50Y10M-100D
P-49Y-2M-100D
*/
case 1: Absolute value of months unit is 10, remains unchanged.
case 2: Absolute value of months unit is 10, but it is changed to -2.
I think you are misreading "The sign of the years and months units will be the same after normalization.". It doesn't mean that both the year and month sign will remain the same, it means that the resulting year sign will be the same as the resulting month sign.
So in your second example, 10 months must be adjusted to become negative. It's a modulus 12 operation with a result that is negative and absolute value less than 12: 10-12=-2.
The year value is then adjusted to keep the same period.