# I don't know how to use ROUND_CEILING

Moham'd
Greenhorn
Posts: 12
hello bro.

can u tell me how to use this code
and what classes do i have to import
if there is a sample code ill be appreciate it

my need of this method is to get the ceiling of a variable(value of this variable is changing since it is inside a loop).

Moham'd

Ryan McGuire
Ranch Hand
Posts: 1073
4
Go read the javadoc for BigDecimal. The second paragraph describes where the "rounding mode" constants such as ROUND_CEILING are used.

Does that page cover what you need?

Ryan

Moham'd
Greenhorn
Posts: 12
Dear Ryan,

thank you for your reply however,

i didn't get what i need.

just i want the way to use this method ROUND_CEILING

as we(I) know, we can use the maximum method of 2 numbers in this way
Math.max(x,y) nice?

what about ROUND_CEILING
i tried to do as in max method
Math.ROUND_CEILING(x), but it doesn't work any way.

just try this code , it is not working

=====
import java.math.*;

public class Test{
public static void main(String[]args)
{
double x=12.67;

System.out.println(Math.ROUND_CEILING(x));
}

}
=======
i got this compilation error,
cannot resolve symbol
symbol: method ROUND_CEILING(double)
======

John Dell'Oso
Ranch Hand
Posts: 130
Moham'd,

As Ryan has suggested, read the javadoc on BigDecimal. Just a couple of hints:

1) ROUND_CEILING is not a method - check the signature of this field and you will find that it is defined as a constant (public static final ...).

2) It is supplied as a field to be used in method calls such as divide and setScale in the BigDecimal class.

3) It is used to define a "rounding mode" to positive infinity.

Perhaps if you describe what you're trying to do, we can help point you to a more suitable solution.

Regards,
JD

PS: You should change your name to adhere to the naming policy on these forums. That is, use first and second names.

[ May 26, 2005: Message edited by: John Dell'Oso ]

[ May 26, 2005: Message edited by: John Dell'Oso ]
[ May 26, 2005: Message edited by: John Dell'Oso ]

Joel McNary
Bartender
Posts: 1840
Moham'd:

Welcome to JavaRanch, and thank you for changing your name. Unfortunately, we do insist that you have a first and last name (please read the JavaRanch Naming Policy. While we prefer that you use your real given and family name (or some derivitive thereof), you can use any non-fictitous sounding name as your display name.

Thanks

John Dell'Oso
Ranch Hand
Posts: 130
Moham'd,

OK .. since you have posted code sort of implying what you are attempting to achieve. Try this:

Regards,
JD

Moham'd
Greenhorn
Posts: 12
Dear Joel McNary,

i will modify my display name as soon as possible
.

Dear John Dell'Oso,
Thank you very much my bro. for your reply. i don't know my be i was looking for something complex and don't satisfy my needs.
In General, your code is exactly what i need.
And thanks one more time

Moham'd