Home > Back-end >  Math. Max () and Integer. Max () what's the difference
Math. Max () and Integer. Max () what's the difference

Time:09-30

M=Math. Max (m, n);
N=Math. Min (m, n);
Why two Numbers change don't come over, and Math. The Max () and Integer. The Max () what's the difference between:
Beginners don't know much about @ @

CodePudding user response:

The two methods is not used to swap places
The two methods is not used to compare the size of the

Math. Max (m, n); Returns the maximum of m and n
The underlying source code is: return (a & gt; A=b)? a : b;

Math. Max (m, n); Returns the smallest m and n
The underlying source code is: return (a & lt; A=b)? a : b;
=============================
Math. Max () and Integer. Max () difference:
1, these two methods there is no actual
2, Math. Max (m, n) of the incoming parameter type can make the two integer or floating point number
Integer. Max (m, n) of the incoming parameter must be an Integer
3, Math. Max (m, n) and Integer. The Max (m, n) were used to compare the size, the maximum return

Integer. Max (m, n) JDK underlying y source:
Public static int min (int a, int b) {
Return Math. Min (a, b);
}
Call is Math. Max (m, n)



CodePudding user response:

Suppose n> M
M=Math. Max (m, n), m is=n (i.e., m and n), and then you
N=Math (m, n) and meaning? M and n, take the minimum or n itself,

CodePudding user response:

Math. Max there are four construction method, corresponding to the incoming parameters for int long double float, Integer. The Max of the underlying class is actually call. Max inside of type int,
  • Related