Math and NumberFormat Classes
Java classes lay the foundation for your programs. The Java Math and NumberFormat classes let you program number values, as well as format numbers and currencies.
The Math class
| num abs(num y); |
Absolute value of y (num can be any numeric data type) |
| num max(num y, num z); |
Maximum of y and z |
| num min(num y, num z); |
Minimum of y and z |
| double = Math. random(); |
Random number — 0.0 < x <= 1.0 |
The NumberFormat class
| NumberFormat getNumberInstance(); |
Gets an instance that formats numbers. |
| NumberFormat getCurrencyInstance(); |
Gets an instance that formats currency. |
| String format(x); |
Formats the specified number. |