[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

RoundingMode.FLOOR - Maps..

Posted on 2006-04-21
7
Medium Priority
?
226 Views
Last Modified: 2010-03-31

Hi , my question is that currently it uses :
RoundingMode.FLOOR, Let's say I dont want floor or ceil, i want it to decide whether to floor or ceil..how to change the roundingmode..
thanks



      for(int i=0;i<years+1;i++)
            {
                  
                  map=new TreeMap<BigDecimal,Integer>();
                  maps.add(map);
                  for(int j=0;j<iterations;j++)
                  {      
                  
            

                        Integer  val=map.get(BigDecimal.valueOf(score[i][j]).setScale(1,RoundingMode.FLOOR));
0
Comment
Question by:Jasbir21
  • 4
  • 2
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 16506156
You can change to whatever mode you want. What do you want to do?
0
 

Author Comment

by:Jasbir21
ID: 16506180
actually, currently, it is flooring..

i dont want flooring..

lets say value is 3.3... , it should round to 3.0

but if value is 3.5, it should round to 4.0

something like this
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 16506195
RoundingMode.HALF_UP

would do that
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 86

Expert Comment

by:CEHJ
ID: 16506281
>>lets say value is 3.3... , it should round to 3.0

Of course the first arg to setScale would be zero for that
0
 
LVL 92

Assisted Solution

by:objects
objects earned 120 total points
ID: 16512300
0
 

Author Comment

by:Jasbir21
ID: 16519121
thanks a lot :-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16519203
:-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month18 days, 20 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question