First of all a hint: You seem to use non-static variables for a static method, wich works if you create an instance of the class and call the static method through the instance. But then it would not make sense using a static method, would it?
Ok, now to your problem:
public someMethod (int d) {
while (d < 0) { //1*
d--; //will never become bigger or equal to 0 => endless loop
}
while (d > 0) { //2*
d++; //will never become smaller or equal to 0 => endless loop
}
}
See? If d is bigger than 0 you will remain in loop 2. If d is smaller than 0 you will remain in loop 1.
Only if d is equal to 0 from the beginning the program will not enter an endless loop.