By Doug Lowe

Part of Java All-in-One For Dummies Cheat Sheet

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
Method Description
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, such that 0.0 < x <= 1.0
The NumberFormat Class
Method Description
Gets an instance that formats numbers.
NumberFormat Gets an instance that formats currency.
String format(x); Formats the specified number.