Separation between integers in Java

I need to split between integers in Java, and the result should be a float.

Can I just use the / symbol for it? How in:

 int integer1 = 1; int integer2 = 2; float quotient = integer1 / integer2; // Could I do this? 
+6
java math integer-division
source share
1 answer

Pass one of the integers to float to provide floating point separation:

 float result = integer1 / (float) integer2 
+22
source share

All Articles