Chapter 7
Exploring the Basic APIs, Part 1
The standard class library’s java.lang and other packages provide many basic APIs that can benefit your Android apps. For example, you can perform mathematics operations and manipulate strings.
Exploring Math
The java.lang.Math class declares double constants E and PI that represent the natural logarithm base value (2.71828...) and the ratio of a circle’s circumference to its diameter (3.14159...). E is initialized to 2.718281828459045 and PI is initialized to 3.141592653589793. Math also declares class methods that perform various mathematics operations. Table 7-1 describes many of these methods.
Table 7-1. Math Methods
Method |
Description |
|---|---|
double abs(double d) |
Returns the absolute value ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access