why version 1 works but version 2 does not work , version 1: class Solution {

public int divide(int dividend, int divisor) {

if(dividend==Integer.MIN_VALUE&&divisor==-1)

return Integer.MAX_VALUE;

if(divisor==1)

return dividend;

if(dividend==divisor)

return 1;

int sign = (dividend>0&&divisor<0||dividend<0&&divisor>0)?-1:1;

int a = Math.abs(dividend);

int b = Math.abs(divisor);

int q = 0;

int res =0;

while(a-b>=0){

while(a-(b<<(q+1))>=0)

q++;

res += 1<<q;

a = a-(b<<q);

q=0;

}

return sign*res;

}

} version 2: class Solution {

public int divide(int dividend, int divisor) {

if(dividend==Integer.MIN_VALUE&&divisor==-1)

return Integer.MAX_VALUE;

if(divisor==1)

return dividend;

if(dividend==divisor)

return 1;

int sign = (dividend>0&&divisor<0||dividend<0&&divisor>0)?-1:1;

int a = Math.abs(dividend);

int b = Math.abs(divisor);

int q = 0;

int res =0;

while(a-b>=0){

while(a>=(b<<(q+1)))

q++;

res += 1<<q;

a = a-(b<<q);

q=0;

}

return sign*res;

} Do not say the word "if(dividend==integer" in the response
user