How to divide two longs and get the value?
java
Solution
You need to either cast one of them as a `float`, or declare one of the variables to be a `float` from the start. Otherwise, Java's integer division takes over, and just as an `int` divided by an `int` must be an `int`, that would apply to `long`s as well.
float c = (float) a / b;
Problem
I need to compute probability of an integer and a long. but I always get 0. int a = 234; long b = 123453344L float c = a /b; How to get it right in Java?