0
How do i convert a negative number into positive even though i applied Math.abs(days) but it doesn't work ?
Java Swing netbeans
5 odpowiedzi
+ 11
Please add a minimal working example on the playground and link it to your question. That will increase the chances to receive helpful answers.
+ 4
days = days < 0 ? -days : days;
+ 2
Math.abs() returns a double.
If you are using int days --> days = (int)Math.abs(days);
+ 1
Can you provide us the code because Mat.abs is the best way to do that