aspose file tools*
The moose likes Java in General and the fly likes Rounding Down To 2 Decimal Places Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Rounding Down To 2 Decimal Places" Watch "Rounding Down To 2 Decimal Places" New topic
Author

Rounding Down To 2 Decimal Places

Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
Hello;

I have a double:

1.44565655755

I would like to round it up to:

1.45

Math.round turn it into a long. Is there not a round method somewhere that I can specify home many numbers after the decimal I would like?

ie: Math.round(1.444455676767, 3) return 1.444


Thanks,

Luke


Luke
SCJP
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Check out the NumberFormat class.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rounding Down To 2 Decimal Places