8302815: Use new Math.clamp method in core libraries

Reviewed-by: alanb
This commit is contained in:
Tagir F. Valeev 2023-02-22 09:51:14 +00:00
parent 5e1d1b7940
commit 3f3a1f534b
11 changed files with 37 additions and 45 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3572,7 +3572,7 @@ public final class DateTimeFormatterBuilder {
}
}
} else {
int outputScale = Math.min(Math.max(fraction.scale(), minWidth), maxWidth);
int outputScale = Math.clamp(fraction.scale(), minWidth, maxWidth);
fraction = fraction.setScale(outputScale, RoundingMode.FLOOR);
if (decimalPoint) {
buf.append(decimalStyle.getDecimalSeparator());