The Math and StrictMath Classes

The Math class provides an extensive set of mathematical methods in the form of a static class library. It also defines the mathematical constants E and PI. The supported methods include arithmetic, trigonometric, exponential, logarithmic, random number, and conversion routines. Browse the API page of this class to get a feel for the methods it provides. The example in Listing 9.2 only touches on a few of these methods.

Note that all of the methods in Math are static, so they are available without the creation of a Math object. In a non-object-oriented language, these methods would be part of a standard mathematical library.

The StrictMath class mirrors the constants and methods of Math and guarantees bit-for-bit ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.