1 /*
2 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1208 * the result is that same value.
1209 *
1210 * @param a an argument.
1211 * @param b another argument.
1212 * @return the larger of {@code a} and {@code b}.
1213 */
1214 @HotSpotIntrinsicCandidate
1215 public static int max(int a, int b) {
1216 return Math.max(a, b);
1217 }
1218
1219 /**
1220 * Returns the greater of two {@code long} values. That is, the
1221 * result is the argument closer to the value of
1222 * {@link Long#MAX_VALUE}. If the arguments have the same value,
1223 * the result is that same value.
1224 *
1225 * @param a an argument.
1226 * @param b another argument.
1227 * @return the larger of {@code a} and {@code b}.
1228 */
1229 public static long max(long a, long b) {
1230 return Math.max(a, b);
1231 }
1232
1233 /**
1234 * Returns the greater of two {@code float} values. That is,
1235 * the result is the argument closer to positive infinity. If the
1236 * arguments have the same value, the result is that same
1237 * value. If either value is NaN, then the result is NaN. Unlike
1238 * the numerical comparison operators, this method considers
1239 * negative zero to be strictly smaller than positive zero. If one
1240 * argument is positive zero and the other negative zero, the
1241 * result is positive zero.
1242 *
1243 * @param a an argument.
1244 * @param b another argument.
1245 * @return the larger of {@code a} and {@code b}.
1246 */
1247 @HotSpotIntrinsicCandidate
1248 public static float max(float a, float b) {
|
1 /*
2 * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1208 * the result is that same value.
1209 *
1210 * @param a an argument.
1211 * @param b another argument.
1212 * @return the larger of {@code a} and {@code b}.
1213 */
1214 @HotSpotIntrinsicCandidate
1215 public static int max(int a, int b) {
1216 return Math.max(a, b);
1217 }
1218
1219 /**
1220 * Returns the greater of two {@code long} values. That is, the
1221 * result is the argument closer to the value of
1222 * {@link Long#MAX_VALUE}. If the arguments have the same value,
1223 * the result is that same value.
1224 *
1225 * @param a an argument.
1226 * @param b another argument.
1227 * @return the larger of {@code a} and {@code b}.
1228 */
1229 public static long max(long a, long b) {
1230 return Math.max(a, b);
1231 }
1232
1233 /**
1234 * Returns the greater of two {@code float} values. That is,
1235 * the result is the argument closer to positive infinity. If the
1236 * arguments have the same value, the result is that same
1237 * value. If either value is NaN, then the result is NaN. Unlike
1238 * the numerical comparison operators, this method considers
1239 * negative zero to be strictly smaller than positive zero. If one
1240 * argument is positive zero and the other negative zero, the
1241 * result is positive zero.
1242 *
1243 * @param a an argument.
1244 * @param b another argument.
1245 * @return the larger of {@code a} and {@code b}.
1246 */
1247 @HotSpotIntrinsicCandidate
1248 public static float max(float a, float b) {
|