Cast one of the integers to float to ensure a floating point division:
float result = integer1 / (float) integer2
More Related Contents:
- Why does dividing a float by an integer return 0.0?
- Fast algorithm to calculate n! / (q!)^r
- How to make fibonacci method? [closed]
- is there an algorithm to reverse a chosen part of a number? [closed]
- Division of integers in Java [duplicate]
- Integer division: How do you produce a double?
- How to resolve a Java Rounding Double issue [duplicate]
- How to parse a mathematical expression given as a string and return a number? [duplicate]
- Strange floating-point behaviour in a Java program [duplicate]
- Fastest way to determine if an integer’s square root is an integer
- Method for evaluating math expressions in Java
- Mod in Java produces negative numbers [duplicate]
- How does java do modulus calculations with negative numbers?
- Performance of Java matrix math libraries? [closed]
- How to handle very large numbers in Java without using java.math.BigInteger
- Is it possible to pass arithmetic operators to a method in java?
- MathML and Java [closed]
- How can I check if multiplying two numbers in Java will cause an overflow?
- midpoint between two latitude and longitude
- How do I get whole and fractional parts from double in JSP/Java?
- Is there a commonly used rational numbers library in Java?
- Calculating the angle between two lines without having to calculate the slope? (Java)
- Nice Label Algorithm for Charts with minimum ticks
- What to do with Java BigDecimal performance?
- Algorithm to generate Poisson and binomial random numbers?
- What is a non recursive solution for Fibonacci-like sequence in Java?
- How to rotate a vertex around a certain point?
- How to round up integer division and have int result in Java? [duplicate]
- Combinatoric ‘N choose R’ in java math?
- Find the max of 3 numbers in Java with different data types