可能的重复:
Java 整数除法:如何产生双精度数?
当我将 2 个数字相除以尝试得到类似 0.90 的结果时,我不断得到 1.0 或 0.0
int number1 = 6517253;
int number2 = 7195629;
double number3 = number1 / number2; //returns 0.0 supposed to be 0.9057239 and I want 0.90
double number4 = number2 / number1; //returns 1.0 supposed to be 1.1040893 and don't really want that one
如果我将 double 更改为 float,也会做同样的事情。