Hello

I'm dealing with positive and negative numbers. I want just to take the number without sign because I will do some comparison so I need to do comparison without considering sign. How can I do it?

thanks

Printable View

- 06-01-2010, 10:50 AMsara12345taking number value without sign
Hello

I'm dealing with positive and negative numbers. I want just to take the number without sign because I will do some comparison so I need to do comparison without considering sign. How can I do it?

thanks - 06-01-2010, 10:52 AMPhHeinCode:
`System.out.println(Math.abs(-223));`

- 06-01-2010, 10:54 AMj2me64

the class math has a abs() method to convert negative numbers. use it. - 06-01-2010, 10:55 AMsara12345
ok thanks but are the numbers must be in integer format or float

thanks alot - 06-01-2010, 10:59 AMPhHein
Did you read the API docs which j2me64 has linked in one minute?! You're fast.

- 06-01-2010, 11:03 AMsara12345
ok thanks alot for helping