O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

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

How to support currency

Many applications deal with currency and it is frequently an integral component of business applications. There are many issues that complicate the representation and use of currency values such as precision and accuracy. In addition, there are differences between how currency types such as rubles and the yen are displayed. In this recipe, we will examine the data types we can use to represent currency and locale-specific issues regarding currency.

Getting ready

There are several potential data types that can be used for representing currency including:

  • Floating point numbers
  • Integer
  • BigDecimal

To determine which is best we need to consider issues such as precision and accuracy. Ease of use is another concern since we will need ...

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