You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
651 B

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package codetoanalyze.java.performance;
class MathTest {
void min_constant(int arr[]) {
for (int i = 0; i < Math.min(3, arr.length); i++) {}
}
void max_symbolic(int arr[]) {
for (int i = 0; i < Math.max(0, arr.length); i++) {}
}
void linear(int p) {
for (int count = 0; count < p; count++) {}
}
void call_with_min_constant() {
linear(Math.min(3, 10));
}
void call_with_max_linear(int x) {
linear(Math.max(1, x));
}
}