• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trim in java

 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am getting a result from java file which is of type double.When displaying this number through jsp file i want only 2 digits to appear after decimal point.
Pls help
 
Benny Tang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can use the method setMaximumFractionDigit() in java.text.NumberFormat to manipulate the format of the number.
Benny T
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This really has nothing to do with JSPs, so I'm moving it along to Java In General (Beginner).
bear
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me exactly how to do this?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the API docs for DecimalFormat and NumberFormat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic