I tried the following code:
System.out.println(0 / 1);
System.out.println(0 / -1);
System.out.println(0.0 / 1.0);
System.out.println(0.0 / -1.0);
And the result is:
0
0
0.0
-0.0
Why does the code evaluate to -0.0 when the divisor is a negative double?How can I get rid of the negative sign?