© Doug Winnie 2021
D. WinnieEssential Java for AP CompScihttps://doi.org/10.1007/978-1-4842-6183-5_19

19. Math Methods

Doug Winnie1  
Mission Hills, KS, USA

Basic math operators will only get you so far. There are a bunch more that you can use to do things with more advanced methods like algebra, trigonometry, statistics, calculus, and more in Java.

Working with Simple Methods

The most basic is working with numbers and rounding them. There are three ways to deal with a decimal value on a number.

The first is to just eliminate it entirely. This is called finding the number’s floor. Any decimal value is simply removed. Even if it is .99999.

The second is to take any decimal value and raise it up to the next whole number, called the number’s ceiling. ...

Get Essential Java for AP CompSci: From Programming to Computer Science 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.