Compare inaccurate because the float in the computer
So be wrong judgment ==
Solutions
Double preErrorKey =-1E. 6; // -6 power i.e. 0.000001 10 * 1 Double key1 = 0.0000001d ; Double key2 = 0D; // System.out.println (== key1 key2); // result is flase / / System.out.println (the Math.abs (key1-key2) <preErrorKey); IF (the Math.abs (daohuoshuliang- shengoushuliang) <preErrorKey && (weidaohuoliang == 0 )) { caigouzhuangtai = "purchase all";