O'Reilly logo

Java: A Beginner’s Tutorial, 4th Edition (Updated for Java SE 8) by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9

Working with Numbers

In Java numbers are represented by the primitives byte, short, int, long, float, double and their wrapper classes, which were explained in Chapter 5, “Core Classes.” Conversion from a primitive type to a wrapper object is called boxing and from a wrapper object to a primitive is called unboxing. Boxing and unboxing are the first topic in this chapter. Afterward, this chapter explain three issues you have to deal with when working with numbers, parsing, formatting and manipulation. Number parsing is the conversion of a string into a number and number formatting deals with presenting a number in a specific format. For instance, 1000000 may be displayed as 1,000,000.

To conclude, this chapter show how to perform monetary ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required