Java Reference
In-Depth Information
Table 4-8 refers to java.math.RoundingMode , which is an enum containing
various rounding mode constants. These constants are described in Table 4-9 .
Thebestwaytogetcomfortablewith BigDecimal istotryitout. Listing4-32 uses
this class to correctly perform the invoice calculations that were presented in Listing
4-31 .
Listing 4-32. BigDecimal -based invoice calculations not leading to confusing results
import java.math.BigDecimal;
import java.math.RoundingMode;
class InvoiceCalc
{
public static void main(String[] args)
{
Search WWH ::




Custom Search